Home >Web Front-end >JS Tutorial >jQuery: Difference analysis of whether there is a space before nth-child_jquery

jQuery: Difference analysis of whether there is a space before nth-child_jquery

WBOY
WBOYOriginal
2016-05-16 18:04:561037browse

Then, I wrote the following html:




12




                                                                        td>31


The expected effect is:




So I wrote the following jQ:

$(".a:nth-child(2)").css("color","red");

The result of running the operation is actually: jQuery: Difference analysis of whether there is a space before nth-child_jquery

I am puzzled. . Finally, I found that JQ was rewritten as:

$(".a :nth-child(2)").css("color","red");

That’s it. jQuery: Difference analysis of whether there is a space before nth-child_jquery

Note: There is a space after a! ! !

Although the problem has been solved, I don’t know the cause. Please give me some guidance. . .

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
11 13
21 32