How to get the class of an element using jQuery

To get the class of an element using jQuery you can use the snippet below.

var className = $('.myId').attr('class');

Please Share us:
Please rate this snippet

5 thoughts on “How to get the class of an element using jQuery

Leave a Reply