Skip to content

Instantly share code, notes, and snippets.

@bekapod
Created May 22, 2012 20:37
Show Gist options
  • Save bekapod/2771470 to your computer and use it in GitHub Desktop.
Save bekapod/2771470 to your computer and use it in GitHub Desktop.
JQUERY: Detect Both Right & Left Mouse-clicks
$("#someelement").live('click', function(e) {
if( (!$.browser.msie && e.button == 0) || ($.browser.msie && e.button == 1) ) {
alert("Left Mouse Button Clicked");
}
else if(e.button == 2)
alert("Right Mouse Button Clicked");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment