Use event.type
:
$('label').bind('click hover', function(event) { if(event.type == 'click') { // do stuff } $('label').removeClass("active"); $(this).addClass("active"); });
Demo: http://jsfiddle.net/jtbowden/sqvDy/
Note. The demo uses .on()
, which is the new event binding method for jQuery 1.7+, replacing .bind()
, .live()
and .delegate()
.
source share