-

xiyuetaCSSJS库 .length

当前匹配的元素数量
快速上手

xiyuetaCSS().length方法 共有一种调用方式:
1、xiyuetaCSS("div").length; //当前匹配的元素数

总结:xiyuetaCSS().length用法与jQuery中.length用法保持一致
see https://api.jquery.com/length
尝试一下>>

  • 代码
  • 效果
<script src="https://www.xiyueta.com/js/xiyueta.min.js"></script>
<script>var html='div{}div{}div{}';
 
xiyuetaCSS().parse(html);
$.log(xiyuetaCSS("div").length);
</script>
3