JavaScript getting an elements class without any libraries

前端 未结 4 692
隐瞒了意图╮
隐瞒了意图╮ 2020-12-10 09:53

I would like to get the value of the class attribute for an element using JavaScript. However in this particular situation I don\'t have the luxury of libr

4条回答
  •  一向
    一向 (楼主)
    2020-12-10 10:45

    Remember:

    If you get an error and className does not work this can be due to your element being a jQuery object.

    In the picture above you see that I canot use className on a jQuery object

提交回复
热议问题