Simply by
var divClass = $("#div1").attr("class")
You can do some other stuff to manipulate element's class
$("#div1").addClass("foo"); // add class 'foo' to div1
$("#div1").removeClass("foo"); // remove class 'foo' from div1
$("#div1").toggleClass("foo"); // toggle class 'foo'