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.