Get First Class Of Element
So let's I have a div with multiple classes like this: In the javascript I only want the first class, like $(document.body).on('click','.s',f
Solution 1:
Try this:
$('.s').click(function()
{
var firstClass = $(this).attr('class').split(" ")[0];
});
Post a Comment for "Get First Class Of Element"