Get first and last class with jQuery

后端 未结 7 1315
一整个雨季
一整个雨季 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:44

    If you're checking to see if a HTML element has a class, you can use .hasClass('classname') which would return true or false.

    Otherwise, if you're trying to see a list, I think you'll have split the string into an array. The other two answers that were just posted will show you how. :)

提交回复
热议问题