suppose I have a html markup like this:
<div>
<p>
this is the parent
<p>
this the child
</p>
</p>
<p>
this is the parent
<p>
this the child
<p>this is third child</p>
</p>
</p>
</div>
In the div I have five <p> tags,but I want only use jquery selector to select the two top parent p tag without class and id name
Is it possible?How can I achieve that?
of course, just do
children only select the direct children of an element. Don’t forget to set an id to your div…