This article reprinted, the original website address: http://blog.sina.com.cn/s/blog_775da6710100vzbr.html
For friends who have just learned jquery, there are times when there is a point of understanding about jquery's Layer selector $ ("ancestor descendant") and $ ("Parent>child"). In fact, it is very simple, after reading the following example you will completely understand.
<div>this is <strong>very</strong> important.</div>
<div>this is <em>really <strong>very</strong></em> important.</div>
The above is HTML. After running in the browser is to see
This is
veryImportant. This is
really very Important.
This style, in order to easily see the effect, we might as well try to add CSS color to try
If you run $ ("div strong"). CSS ("Color", "red"), the strong of the descendant elements of the div is changed to red. After the run is
This is
veryImportant. This is
really very Important. If you run $ ("Div>strong"). CSS ("Color", "blue"), the child element of the div is strong to blue. After the run is the IS
veryImportant. This is
really very Important.
See here I think should all understand, if not understand, can be popular so understanding, such as a family three generations together, Grandpa, Father and you, so grandpa's son element is your father, and your father is also the descendants of Grandpa elements, and you are only the descendants of Grandpa elements.
The difference between the neutron element and the descendant element of jquery