I want to check the class of a div and change it to the other one when clicked.
Something must be wrong with my if statement.
$("#mapresize").click(function() { if (this.className == "mapexpand width100") { $("div", this).attr('class', 'mapcollapse width100'); $("#checkin-gmap").animate({ height: '500px' }, 500, function() { google.maps.event.trigger(map, "resize"); }); // $(".checkinmap-control").show("500"); } else { $(this).attr('class', 'mapexpand width100'); $("#checkin-gmap").animate({ height: '250px' }, 500, function() { google.maps.event.trigger(map, "resize"); }); // $(".checkinmap-control").hide("500"); } return false; });