The below code snippet explains how to get class name attribute of an HTML control using jQuery
<div class = "myClass" id = "myDiv"></div>
<input type="button" id="demo" value = "Demo" />
 
<script type = "text/javascript" src = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.1.min.js"></script>
<script type="text/javascript">
    $("#demo").live("click", function () {
        var className = $("#myDiv").attr("class");
        alert(className);
    });
</script>
 
Explanation:
In the above sample, a click event handler has been attached to the HTML button with id “demo”. When the button is clicked the name of the class is fetched using the attr("class") method of jQuery and it is displayed in the alert box.