I use a jquery selector :
$('#menus>ul>li>a')
I'd like to to iterate the selector result without the last one:
$('#menus>ul>li>a').removeLast().each(fct());
Ofcourse the function "removeLast()" doesn't exist, is there an equivalent ?
Thanks.
You can use the :not
selector or the .not()
method:
$('#menus>ul>li>a:not(:last)')
or
$('#menus>ul>li>a').not(":last")
Use a combination of the :not
and :last
selectors:
$('#menus > ul > li > a:not(:last)')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With