javascript - If statement based on what element is underneath -
i have dynamic troublesome website;
wondering if write if statement jquery or raw js hide element based on if element underneath it.
so like; if <h1>
tag straight beneath div id, maintain div element present; else display: none;
you can utilize not
, has
, first-child
selector:
$('div:not(:has(>h1:first-child))').hide();
demo: http://jsfiddle.net/c9emjotg/
javascript jquery
No comments:
Post a Comment