var options = {};
$('input[name="options[]"]:checked').each(function(){
options[$(this).val()] = $(this).next('label').text();
});
options = {
"ivanoff@gmail.com": "Иванов",
"doe@gmail.com": "Doe"
}
function toLatin() {
translate = translate.split('').map((item) => {
let _pos = cyrillic.indexOf(item);
return _pos == -1 ? item : latin[_pos];
}).join('');
};
<form action="server.php" method="POST">
<form action="server.php" method="POST" id="formName">
$('#formName').submit...
$(document).ready(function(){
function sameFunc() {
// code
}
}):
var sameFunc = null;
$(document).ready(function(){
sameFunc = function() {
// code
}
}):
$( "#sortable1, #sortable2,#sortable3" ).sortable({
connectWith: ".connectedSortable"
}).disableSelection();
$( function() {
$( "#sortable1" ).sortable().disableSelection();
$( "#sortable2, #sortable3" ).sortable({
connectWith: ".connectedSortable"
}).disableSelection();
} );
$("#btn_delete").on("click", function(){
$(this).parent().remove();
});
$(document).on("click", "#btn_delete", function(){
$(this).parent().remove();
});
source: 'search.php',
source: function(request, response) {
$.ajax({
url: "search.php",
method: "GET",
dataType: "json",
data: {
term: request.term,
},
success: function(data){
response(data);
},
});
},
let user = {
firstUser: {
age: 22
}
}
function rec(user) {
for (let key in user) {
if (typeof (user[key]) == "object") {
console.log(key)
rec(user[key]);
} else {
console.log(key.toUpperCase())
}
}
}
rec(user)
let user = {
firstUser: {
age: 22
},
testLevels: {
is2level: {
a2level: {
a3level: 100
}
}
}
}
let level = 1;
function rec(user) {
switch(level) {
case 3:
console.log('Привет, это 3 уровень вложенности');
break;
case 10:
console.log('Привет, 10 уровень');
break;
}
for (let key in user) {
if (typeof (user[key]) == "object") {
++level;
console.log(key)
rec(user[key]);
} else {
console.log(key.toUpperCase())
level = 0
}
}
}
rec(user)
DOMSubtreeModified устарело в пользу MutationObserver.