Disable right click with jquery

jQuery makes it easy to disable the right click with just few lines of codes. bind contextmenu to the document and return false. however, this will disable the right click on entire document.
$(function(){ //document.ready function
        alert('right click disabled');
        return false;
to disable right click in certain elements, you can give it a class/id and use respective selector.
right click disable right click
right click no right click
try it in fiddle


  1. Thanks the give script of disable right click is fully working for me.

    Before disable right-click you need to know its corn. It is used to navigate (go back/forward), reload and add to favorites. If you disable it, your visitors will suffer and likely avoid your blog.

    instead of this, it is better to use disable selection of text or html :

    Add the following html code to your BODY tag:
    Here is how your BODY tag may look once implemented:

    ondragstart=”return false” onselectstart=”return false”

    Checkout the demo of script on this blog: www.originbuzz.com


  2. Great Article i have learned so many things from your article

    Please check this and tell me more about it:


Post a Comment

Popular posts from this blog

jquery attr() vs prop() (difference)

jQuery popup (dialog) form validation on a normal button click

Close jQuery Dialog Box when clicked outside of the dialog popup