- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to handle a mouse right click event using jQuery?
To handle a mouse right click event, use the mousedown() jQuery method. Mouse left, right and middle click can also be captured using the same method. You can try to run the following code to learn how to handle a mouse right click event:
Example
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $('.myclass').mousedown(function(event) { switch (event.which) { case 1: alert('Left mouse button is pressed'); break; case 2: alert('Middle mouse button is pressed'); break; case 3: alert('Right mouse button is pressed'); break; default: alert('Nothing'); } }); }); </script> </head> <body> <a href="http://qries.com" class="myclass">Click me</a> </body> </html>
- Related Articles
- How to handle a link click event using jQuery?
- How to handle a double click event using jQuery?
- How to submit a form using jQuery click event?
- How to disable right click using jQuery?
- How to handle a Button click event in tkinter?
- How to handle the click event in Listview in Android using Kotlin?
- How to handle jQuery AJAX success event?
- Store mouse click event coordinates with Matplotlib
- How to handle the click event in ListView in android?
- How can I show and hide div on mouse click using jQuery?
- How to get attribute of an element when using the 'click' event in jQuery?
- How to handle bind an event using JavaScript?
- Trigger an event IMMEDIATELY on mouse click, not after I let go of the mouse - JavaScript?
- How to create right click using selenium?
- How to disable mouse event on certain elements using JavaScript?

Advertisements