lindm Posted June 18, 2009 Share Posted June 18, 2009 How do you get the classname from an element with multiple classes? Link to comment https://forums.phpfreaks.com/topic/162784-thisclassname-from-element-with-multiple-classes/ Share on other sites More sharing options...
RichardRotterdam Posted June 19, 2009 Share Posted June 19, 2009 If you mean like in the following situation <div id="mydiv" class="class1 class2 class3"></div> <script> alert(document.getElementById('mydiv').className); </script> I see it alerts "class1 class2 class3" Either you can split that using split() or you could use a js framework which returns the class names as an arrray. I know jquery and mootools does this. Link to comment https://forums.phpfreaks.com/topic/162784-thisclassname-from-element-with-multiple-classes/#findComment-859770 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.