I\'m writing event handlers using jQuery, and had a question about the click and double-click events. I\'ve got an element with a class \"file\" on it. It has two event handlers
Dont trust the first answers, thats really really bad. Use this instead:
$('.file').on('click', function() { $(this).css('background', 'blue'); }); $('.file').on('dblclick', function(event){ event.preventDefault(); $(this).css('background', 'green'); });
http://jsfiddle.net/H42KV/