Open In App
Related Articles

How to disable right-click option using the jQuery ?

Improve Article
Save Article
Like Article

The bind() method in jQuery is used to attach one or more event handlers for selected element and this method specifies a function to run when an event occurs.


$(selector).bind(event, data, function);

Parameters: This method accepts three parameters as mentioned above and described below:

  • event: It is an event type which is passed to the selected elements.
  • data: It is the data which can be shown over the selected elements.
  • function: It is the function which is performed by the selected elements.

Return Value: It returns all the modification made on the selected element.

In this article, we will see how to disable the right-click option using the jQuery bind() method.


<!DOCTYPE html>
    <!-- Adding jQuery scripts required to run jQuery -->
    <script src=
    <!-- This script will prevent 
        right click -->
        $(document).ready(function () {
            $(document).bind("contextmenu", function (e) {
                return false;
    <!-- Adding style -->
        h1 {
            color: green;
        p {
            color: crimson;
<!-- Body of the page -->
            GeeksforGeeks is a Computer Science
            portal for geeks. It contains well
            written, well thought and well
            explained computer science and
            programming articles, quizzes etc.


You can see that you can’t open the right-click option window by right-clicking on the screen.

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 10 Dec, 2020
Like Article
Save Article
Similar Reads
Complete Tutorials