First, explain what the selector means by using a space, and if the two elements in the selector are separated by a space, the descendant elements of the previous element are represented. For example, $ (' Div:hidden '), which represents all the hidden elements in the div, this hidden element can be a child element of a div, or it can be a child of a div child element. If there is no space in the selector, it represents a and the relationship, if you say $ (' Div:hidden '), represents all the hidden Div, this is not related to the level of the elements!
Let's look at an example: the HTML code section
<div>
<div style= "Display:none;" >aa</div>
<div style= "Display:none;" >bb</div>
<div style= "Display:none;" >cc</div>
<div style= "Display:none;" >dd</div>
</div>
<div style= "Display:none;" >ee</div>
<div style= "Display:none;" >ff</div>
jquery section
var $ta = $ ('. Test:hidden '); A selector with a space represents all the hidden elements in the element with class test, and obviously the result is all the elements in the first Div.
var $TB = $ ('. Test:hidden '); A selector without a space that represents class test and is a hidden element, which refers to the last two Div and the final child element in the first Div
Alert ($ta. length); Output is 4
Alert ($tb. length); Output is 3
jquery Selector Hollow lattice problem can not be ignored, so in the development process must be clear ideas to see if you need to add space.
Summarize
There are two jquery expressions
$ (". Active:hidden") a selector with a space that represents the descendant selector and selects all hidden child objects within the style active.
$ (". Active:hidden") selector with no space, representing a filter, selecting an object with style active and hidden.