+ 3
jQuery Selectors
i'm a little bit confused with parent > child thing please help me figure this out! parent > child $("div > p") all <p> elements that are a direct child of a <div> element what does this mean?
7 Respostas
+ 9
It is very similar but there is a small and important difference between them, i recommend to read this thread, especially the second most voted answer..!
[ ...A space selector will select all deep descendants whereas a greater than > selector will only select all immediate descendants. ]
https://stackoverflow.com/questions/4459821/css-selector-what-is-it
+ 9
That means exactly what's written in.
<div> <!-- father -->
<p></p> <!-- child -->
<p></p> <!-- child -->
</div>
In this case you're going to select <p> elements inside the <div> element.
+ 3
tnQ so much
it helped me a lot
+ 2
isn't this same with the
$("div p")
???
it selects all the p elements inside the div element
0
The div element contains p so p child div
0
let's just say <div> is a father then he as like 4 children that is <div> <!- father ->
<p></p> <!- child ->
<p></p> <!- child ->
<p></p> <!- child ->
<p></p> <!- child ->
</div>
then you can select any of the child or all
- 1
Hello