jQuery > Traversing methods

find - Find descendant elements in jQuery

How to find all descendant elements of the parent element in jQuery?


To find the descendent of the specified element, find() method can be used.

 <script>
      $("div").find(".class1").css("border", "5px dashed green");
  </script>

Above code snippet shall find only those div elements that are descendent elements (children elements) and have class attribute value as “class1”.

The different between find and filter is that filter works on the specified element only however find works in the descendent elements.

 Views: 5941 | Post Order: 44



Write for us






Hosting Recommendations