jQuery( selector [, context ] )
$(this).find('.myClass')
равна $('.myClass', this)
for( var key in data.items) {
var item = data.items[key]
console.log(key, item)
for (var key2 in item) {
var item2 = item[key2]
console.log(' ' + key2, item2)
}
}
function arrayUnique(arr){
return arr.filter((e,i,a)=>a.indexOf(e)==i)
}
// test
console.info(arrayUnique([1, 2, 1, 10, 5, 3, 4, 40, 50])) // -> [1, 2, 10, 5, 3, 4, 40, 50]
console.info(arrayUnique([1, 2, 3, 1, 2, 33, 33, 55, 66])) // -> [1, 2, 3, 33, 55, 66]
console.info(arrayUnique(['privet', 'privet', 'kakdela'])) // -> ["privet", "kakdela"]
The form $().dataTable() will return a jQuery object, while $().DataTable() returns a DataTables API instance.
jQuery.fn.anyBodyHome = function (selector) {
return this.is(selector) ? this
: this.find(selector).first()
}
return this.is(selector) || this.find(selector).length > 0
cmd /c ping.exe & pause
(вместо ping ваша программа) <html>
<head></head>
<body>
<h1>test</h1>
<script>
var css = 'h1 { background: red; } body {background-color: lightgray; }',
head = document.head || document.getElementsByTagName('head')[0],
style = document.createElement('style');
style.type = 'text/css';
if (style.styleSheet){
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
head.appendChild(style);
</script>
</body>
</html>
var serverTimestamp = <?php echo time();?> // или какой там у вас серверный язык
var serverDate = new Date(serverTimestamp)
var day = serverDate.getDay()
document.getElementById('data').innerHTML = day + 2;