$.each(data, function(i){
var element = this;
setTimeout(function() {
console.log("ID: " + element.ui_id);
console.log("Имя: " + element.name_market);
console.log(""+i);
}, 2000 * i, element);
});
add_action("admin_enqueue_scripts", function() {
wp_enqueue_script("your-script-unique-name", "/path/to/script", ["jquery", "jquery-ui-sortable"], "1.0.0.", true)
});
function findEqualObjects(someArray, otherArray) {
var equalObjects = [];
someArray.forEach(function(elementOfSomeArray) {
otherArray.forEach(function(elementOfOrherArray){
if (JSON.stringify(elementOfSomeArray) === JSON.stringify(elementOfOrherArray)) {
equalObjects.push(elementOfOrherArray);
}
});
});
return equalObjects;
}
$('body').on('mouseenter', 'img', function() {
alert(123);
});
$('body').on('keyup', '.select-city', function(e){
console.log(e.target.value)
});
// Предотвращение закрытия подменю
$('.navbar-main-menu > li, .sub-menu').on('mouseover', function() {
clearTimeout(menuItemOpenedTimeout);
});
// Закрытие всех подменю через 300 миллисекунд в случае покидания мышкой зоны родительского пункта меню
$('.navbar-main-menu > li').on('mouseleave', function() {
menuItemOpenedTimeout = setTimeout(function() {
$('.sub-menu').hide();
}, 300);
});
// Открытие подменю
$('.navbar-main-menu > li').on('mouseover', function() {
// Закрытие всех открытых подменю
$('.sub-menu').hide();
// Открытие текущего подменю
$(this).find('.sub-menu').show();
});
if ($('div.step').eq(current_step).find('input').val() == '') {
alert('Пожалуйста, заполните поле');
return false;
}
var navigationId = 1;
var id = navigationId++;
console.log(id); // ouput: 1
console.log(navigationId); // output: 2
var navigationId = 1;
var id = ++navigationId;
console.log(id); // ouput: 2
console.log(navigationId); // output: 2
$('input').on('focusout', function() {
var rawValue = $(this).val();
var roundedValue = Math.round(rawValue.replace(",", ".")*100)/100;
$(this)
.attr('data-raw-value', rawValue)
.val(roundedValue);
}).on('focusin', function() {
if (typeof $(this).attr('data-raw-value') !== 'undefined') {
var roundedValue = $(this).attr('data-raw-value');
$(this).val(roundedValue);
}
});