内容简介:翻译自:https://stackoverflow.com/questions/2735891/how-to-remove-the-last-element-of-a-jquery-selection
我使用 jquery
选择器:
$('#menus>ul>li>a')
我想在没有最后一个的情况下迭代选择器结果:
$('#menus>ul>li>a').removeLast().each(fct());
当然函数“removeLast()”不存在,是否有等价的?
谢谢.
您可以使用:not selector或.not()方法:
$('#menus>ul>li>a:not(:last)')
要么
$('#menus>ul>li>a').not(":last")
翻译自:https://stackoverflow.com/questions/2735891/how-to-remove-the-last-element-of-a-jquery-selection
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- HashMap之元素删除
- LeetCode-数组-删除元素
- PHP删除数组中指定下标的元素方法
- php – 删除foreach循环中的数组元素
- php 删除一维数组中某一个值元素的操作方法
- jQuery删除/清空指定元素下的所有子节点的方法
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
JavaScript Patterns
Stoyan Stefanov / O'Reilly Media, Inc. / 2010-09-21 / USD 29.99
What's the best approach for developing an application with JavaScript? This book helps you answer that question with numerous JavaScript coding patterns and best practices. If you're an experienced d......一起来看看 《JavaScript Patterns》 这本书的介绍吧!
html转js在线工具
html转js在线工具
HEX CMYK 转换工具
HEX CMYK 互转工具