How to Find Out Last Index of each() in jQuery?

后端 未结 6 1891
轻奢々
轻奢々 2020-12-24 06:45

I have something like this...

$( \'ul li\' ).each( function( index ) {

  $( this ).append( \',\' );

} );

I need to know what index will b

6条回答
  •  一整个雨季
    2020-12-24 07:06

    using jQuery .last();

    $("a").each(function(i){
      if( $("a").last().index() == i)
        alert("finish");
    })
    

    DEMO

提交回复
热议问题