jquerycss-selectors

Accessing child elements in a function (jQuery)


jQuery

$("#myID").each(function() {
  $(this).dosomething;
});

HTML:

<div id="myID">
 <div class="myClass">content</div>
</div>

How do I access myClass from the function? this>myClass ?


Solution

  • $(this).children(".myClass")