I have a div with few classes in no specific order.
<div class="whatever styledark myclass"></div>
I’m interested in the styledark class. This can be styledark, stylewhite, stylered…. I want to get this class name no matter what color comes after the word style. The question is, when i click on the div, how i do i alert this class name that start with the word style disregarding other classes in the div. The classes are in no specific order.
This is a great question. Although it can be done using many of the answers mentioned here, this is a little awkward and costly performance wise. The way i would recommend you do it is put the style class last, that way with only one line of code you can output the class name you are after.