X10nD X10nD - 1 year ago 81
jQuery Question

Get class name using jQuery

I want to get the class name using jQuery

And if it has an id

<div class="myclass"></div>

Answer Source
var className = $('.myclass').attr('class');

should do the trick.