badwolfff
asked on
How do I user jQuery to hide a parent of a specific element?
I have created a jsfiddle for this:
https://jsfiddle.net/Lqfdhyu4/
If the condition is met, then I need to hide the div.form-group and the h4 the precedes it:
<h4><br>Product Attributes</h4>
thanks
https://jsfiddle.net/Lqfdhyu4/
If the condition is met, then I need to hide the div.form-group and the h4 the precedes it:
<h4><br>Product Attributes</h4>
thanks
ASKER
Hi,
not working for me. I tried this on jsfiddle as suggested by you
not working for me. I tried this on jsfiddle as suggested by you
if( ( $('body[class^="product-product-"] #content .form-group select option, body[class^="service-product-"] #content .form-group select option').length ) == 1)
{
$('h4','#product').hide();
}
else{
alert("not found");
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
$('h4','#product').hide();
// hide the first h4 within #product
$('h4:eq(0)','#product').h