I have a div having many classes , let suppose
<div class="myDiv one two three"></div>
Now I want to get the class names using the class "myDiv", here are some cases , in some cases I need the class name which is on third position i.e "two", In some times I need class on position second which is "one", can any one have idea to get my desired classes. My jQuery code is
alert($('.myDiv').attr('class'));
But this alert all the classes.
' '.hasClass(). Soif ($('.myDiv').hasClass('one')) { // do Something }.