Can you assist me in hiding the child element with the class of .secondchild
within a parent element that has a child class?
Below is the code snippet:
HTML code
<div class="parent">
<div class="child">
children
</div>
</div>
<div class="mother">
<div class="secondchild">
second-child
</div>
</div>
I tried using the following script but it did not work:
if ($(".parent").hasClass("child")) {
$('.mother .secondchild').hide()
}