I want to create a function to remove parent if count of visible children is 0
.
<div>
<div class='postitle'>lorem ipsum</div>
<div class='postitle'>lorem ipsum</div>
<div class='postitle'>lorem ipsum</div>
</div>
nores('postitle');
function nores(el) {
el = $('.' + el);
let pnt = el.parent();
if ((el + ':visible').length == 0) {pnt.remove();}
}
Simply doesn't work and console is empty.