javascript - How to target a div by class name inside another class -
i have divs this.
<div class"parent"> <div class"child"> stuff here </div> </div> <div class"parent"> <div class"child"> other kinda stuff here </div> </div>
i want click parent class , show child class inside parent without showing other children classes in other parent classes.
$(document).on('click', '.parent', function(){ $(this).find($('.child').show(500)); });
pass selector string find()
not object - passing jquery object. have invalid html because class"parent"
should class="parent"
.
$(document).on('click', '.parent', function(){ $(this).find('.child').show(500); });
Comments
Post a Comment