if statement changing class of a div

if statement changing class of a div

I am stuck here big time.

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.

I will appreciate a lot.



  1.                             <div class="mapexpand width100" id="mapresize">
  2.                             </div>
  3. $("#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; });