- 1

jquery

Select all elements that are direct children of div elements. $("div > p") it is correct or not ??

12th Jul 2017, 3:13 PM
Tirth Luhar
Tirth Luhar - avatar
2 Respostas
+ 4
It's not, or the question is incomplete: $('div > p') ... will select all <p> elements that are direct children of a <div> To select all elements that are direct children of <div>, you must write: $('div > *') Anyway, this is less related to JQuery than to Css, as it use Css selectors ;P
12th Jul 2017, 4:28 PM
visph
visph - avatar
0
why is it change to * because the information I got tells me that $("div>p")
21st Nov 2020, 8:47 PM
Andile
Andile - avatar