Trick to disable right click using JavaScript / jQuery

Trick to disable right click using JavaScript / jQuery

Learn the trick to disable right click using JavaScript or jQuery on a webpage.

Disable right click using  jquery

<script type='text/javascript'>
  return false;

Disable right click using  javascript

<script type="text/javascript">
    if (document.addEventListener) {
        document.addEventListener('contextmenu', function(e) {
        }, false);
    } else {
        document.attachEvent('oncontextmenu', function() {
            window.event.returnValue = false;

This above snippet has been taken from this site

Get the latest updates directly in your inbox for FREE: Subscribe here

Share your feedback / let me know your doubts regarding this tutorial in the comment box given below.


Shahrukh Khan (Hasan)

A software engineer who's a die-hard coder, blogger, dreamer and mentor with years of expertise in web development. Know more...

Related Posts

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.