Loop through all elements with class 'blah' and find the highest id value

前端 未结 4 2131
闹比i
闹比i 2021-02-13 20:25

I have a bunch of elements like:

..

I want to loop through all of them and get the highest

4条回答
  •  独厮守ぢ
    2021-02-13 21:21

    You want to use parseInt so numerical operators apply

    var id = parseInt($(this).attr('id').split('-')[1]);
    

提交回复
热议问题