In learning jquery to the ": Nth-child" selector of the child element filter selector, I found that when using the ": Nth-child" code, the preceding space for the page display will have a different effect, as follows: without spaces:
$ (' Div.one:nth-child (1) '). CSS (' background ', ' Darkgoldenrod ');
Display effect:
When adding spaces:
$ (' Div.one:nth-child (1) '). CSS (' background ', ' Darkgoldenrod ');
Display effect:
The distinction is obvious, so the individual understands:: The Nth-child is preceded by a space because of the logic of the $ (' ancestor descendant ') in the jquery hierarchy selector, that is, after adding a space: Nth-child gets the front ancestor The descendant element of the element descendant. The above example explains:
When: Nth-child is not preceded by a space,: Nth-child is Div.one index to obtain the conditions, so it gets the Div.one element with the index number 1 element. When: Nth-child preceded by a space,: Nth-child is indexed by Div.one's descendant elements, which means that, in the case of a space, the selector chooses the element with the index number 1 under the <div> parent element of class one.
PS: The two great gods in the question area have also helped to answer my questions, and the answer, like my personal understanding, has confirmed my understanding and thanked the following two teachers again: