-

xiyuetaCSS().last() 属性方法

将匹配元素的集合减少到集合中的最后一个
快速上手

xiyuetaCSS().last()属性方法,一种调用方式:
1、xiyuetaCSS("div").last(); //将匹配元素的集合减少到集合中的最后一个,等同于 .eq(-1)

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

  • 代码
  • 效果
<script src="https://www.xiyueta.com/js/xiyueta.min.js"></script>
<script>xiyuetaCSS().parse("div{color:red}div{color:blue}div{color:green}");
$.log( xiyuetaCSS("  div   ").last().text()  )
</script>
this is www.xiyuetaCSS.com@