Get first and last class with jQuery

后端 未结 7 1314
一整个雨季
一整个雨季 2021-02-09 02:58

Might be a newbie question. I have a code line like this:

I need to get each class for itself.

7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-09 03:53

    You can use the Javascript split() method:

    var classes = $(this).attr("class").split(" ");
    

提交回复
热议问题