How to Search Child Element inside Parent Elements in JQuery


You want to search child elements nested inside any parent element. You can use JQuery find method as shown below:

Let's say you have following parent and child elements in HTML

<div id="parent"> 
   <span id="child">I am child</span> 
</div>

You can use find method as follows:

$("#parent").find("#child");

There are some other shortcuts to access the child elements in JQuery such as given below:

$("#child", $("#parent"));

or

$("#child", "#parent");

 

 

About author


User avatar

Waqas Anwar

Founder of EzzyLearning.com, Senior Consultant, Microsoft .NET and Web Technologies

Comments 1

user
Tbag
  • 10 February 2017

Nice and plain memo,thx

Add Comment