getAttribute cannot return class in IE7?

后端 未结 5 1658
暖寄归人
暖寄归人 2021-01-04 18:59

I need to find random nodes according to random attribute values. To do that I use getAtrribute on nodes from getElementsByTagName.

It seems like when I look for cl

5条回答
  •  别那么骄傲
    2021-01-04 19:40

    It's worth testing all of your Javascript cross-platform, if you're not using something like jQuery to take the pain away, but Class may just be a special case.

    This should be a cross-platform way of getting the class:

    element.className
    

提交回复
热议问题