Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the jquery selector '$("#someID > * *")' mean?

What is the meaning of this selector: $("#someID > * *")

I know that > means child nodes and * means all nodes, but I'm confused by the two asterisks. Any ideas?

like image 607
Mahmoud Farahat Avatar asked Sep 20 '10 17:09

Mahmoud Farahat


People also ask

What does this jQuery selector do $( div p?

Description. "$("div p")" Selects all elements matched by <div> that contain an element matched by <p>.

What does the selector do?

A selector is one of the properties of the object that we use along with the component configuration. A selector is used to identify each component uniquely into the component tree, and it also defines how the current component is represented in the HTML DOM.


1 Answers

It selects all grandchildren or lower of #someID.

Explanation:

#someID > * selects all direct children of #someID.
Adding  * will select all descendants of those children. (but not the children themselves)

Thus, it will select all descendants of #someID except for its direct children.

It could also be written as $('#someID *').not('#someID > *').

like image 96
SLaks Avatar answered Sep 20 '22 07:09

SLaks