- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHPPhysics
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
What is oncontextmenu event in JavaScript?
On right click of an element, when the context menu opens, then it is known as oncontextmenu in JavaScript.
Example
You can try to run the following code to learn how to work with oncontextmenu event in JavaScript −
<html>
<head>
<script>
<!--
function sayHello() {
alert("You right clicked here.")
}
//-->
</script>
</head>
<body>
<p oncontextmenu = "sayHello()">Right click</p>
</body>
</html>Advertisements