javascript - jquery has() not working as expected -
let's have markup:
<div class="comment"> <span class="test">some content here</span> <p>lorem ipsum</p> </div> <div class="comment"> <p>lorem ipsum</p> </div> i want check if span.test exists within div.comment , if exists hide div.comment , show div.comment in span.test doesn't exist.
i'm stuck here :
if($("span.test").length) { $(".element:has(span.test)").hide(); i don't know how continue achieve want.
any suggestions on how can make work ?
$("div.comment").filter(function () { return $(this).find('span.test').length }).hide();
Comments
Post a Comment