lindm Posted June 18, 2009 Share Posted June 18, 2009 How do you get the classname from an element with multiple classes? Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.