Well I already saw this question here. But m a little bit of confused. There were several solutions provided:-
var div1Class = $('#div1').attr('className');
This one was the accepted solution with 2 up votes.
var divClass = $("#div1").attr("class")
This got an up vote too.
Which is the correct one? And if both are correct, what is the difference between the two?