Home >Web Front-end >JS Tutorial >Usage examples and precautions when the selector contains spaces_jquery

Usage examples and precautions when the selector contains spaces_jquery

WBOY
WBOYOriginal
2016-05-16 17:27:31971browse
Principle explanation:

var $t_a=$(".test :hidden") //The space indicates that the class is selected as the hidden element in test;
var $t_a =$(".test:hidden")//Without spaces, it means selecting hidden elements with class test;

Example:
Copy code The code is as follows:








< ;div class="test" style="display:none;">

dddddddd


dddddddd







The output results are: 2 and 3 respectively;
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
Previous article:Detailed explanation and examples of JavaScript timer_javascript skillsNext article:Detailed explanation and examples of JavaScript timer_javascript skills

Related articles

See more