Distinguish between left and right mouse click with jQuery.
HTML Code:
<!DOCTYPE html> <html> <head> <script src="https://code.jquery.com/jquery-git.js"></script> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>Distinguish between left and right mouse click with jQuery</title> </head> <body> <h1 class="element">jQuery Exercises</h1> </body> </html>
JavaScript Code:
$(document).on("contextmenu", ".element", function(e){ console.log('Right Mouse Clicked!'); return false; }); $(document).on('click', '.element', function(){ console.log('Left Mouse Clicked!'); });
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
HTML Code:
JavaScript Code: