jQuery 带空格选择器的注意事项
更新:HHH   时间:2023-1-7


<div class="test">
    <div >aa</div>
    <div >bb</div>
    <div >cc</div>
    <div class="test" >dd</div>
</div>
<div class="test" >ee</div>
<div class="test" >ff</div>

$('.test :hidden').length //带空格 输出4 :选出class为‘test’元素里的隐藏元素
$('.test:hidden').length //不带空格 输出3 :选出隐藏的class为‘test’的元素

从《轻量级javaEE企业应用实战》中记载,学习笔记。

返回web开发教程...