var array = [];
$('.inner-menu > span').each(function(){
array.push({
object: $(this),
name: $(this).text(),
sub: $(this).data('sub'),
pnd: $(this).data('pnd'),
otd: $(this).data('otd'),
});
});
console.log(array);
[{"name":"Текст","sub":1,"pnd":2,"otd":3},{"name":"Текст","sub":1,"pnd":2,"otd":3},{"name":"Текст","sub":1,"pnd":2,"otd":3},{"name":"Текст","sub":1,"pnd":2,"otd":3},{"name":"Текст","sub":1,"pnd":2,"otd":3},{"name":"Текст","sub":1,"pnd":2,"otd":3},{"name":"Текст","sub":1,"pnd":2,"otd":3},{"name":"Текст","sub":1,"pnd":2,"otd":3}]
$(this).parents('.portfolio')
function parents(el, selector) {
const p = [];
while ((el = el.parentNode) !== document && el) {
(!selector || el.matches(selector)) && p.push(el);
}
return p;
}
parents(this, '.portfolio')
$(this).parent('.portfolio')
this.parentNode.classList.contains('portfolio') ? this.parentNode : null
$(this).children('.portfolio')
[...this.children].filter(n => n.classList.contains('portfolio'))
// или
Array.prototype.filter.call(this.children, n => n.matches('.portfolio'))
// или
this.querySelectorAll(':scope > .portfolio')
$(this).find('.portfolio')
this.querySelectorAll('.portfolio')
$(this).next('.portfolio')
(el => el && el.matches('.portfolio') ? el : null)(this.nextElementSibling)
Изучаю PHP рекомендуют читать чужой код.
$date = date('Y-m-t',strtotime($yourDate)); // last day of month
echo date('Y-m-d', strtotime($date. ' + 5 days')); // add 5 days to date