jQuery - get a list of values of an attribute from elements of a class

后端 未结 5 2057
北荒
北荒 2020-12-04 07:34

I have a class .object which has an attribute called level. I want to get a list of all the different values of level on the page so I

5条回答
  •  误落风尘
    2020-12-04 08:30

    the selector

    $(".object[level]")
    

    will give you all the dom elements with class object and an attribute level.

    Then you can just use the .each() method to iterate over the elements to get the highest value

提交回复
热议问题