I have a nested div that gets loaded using PHP include. It gets to put two places, each inside a different parent div.
<div id="parent_div">
<div id="contact_details_div" class="contact_details_div sameheight">
<h3>Some Text</h3>
Some additional Text
</div>
<div id="contact_div" class="contact_div sameheight">
Even more text
</div>
</div>
The parent div can be one of two different ID's.
How, using jQuery or just Javascript, can I remove the class 'sameheight' when the parent div is a specific ID name?
This works but removes it from BOTH parent divs.
$( "#contact_details_div" ).removeClass( "sameheight" )
$( "#contact_div" ).removeClass( "sameheight" )
I'm guessing I need an IF statement but, not sure how to write it.
id? That's not supposed to be the case, ever, and fixing that will also solve your problem. Remove theids, and you can do$('#parent_div .contact_details_div')to select a specific element as opposed to all of them.