内容简介:翻译自: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
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。