Topbar Left

+91-183-2401000

Follow Us

How to Disable right click using jQuery

How to Disable right click using jQuery

[fullwidth backgroundcolor=”” backgroundimage=”” backgroundrepeat=”no-repeat” backgroundposition=”left top” backgroundattachment=”scroll” bordersize=”0px” bordercolor=”” borderstyle=”” paddingtop=”px” paddingbottom=”px” paddingleft=”px” paddingright=”px” menu_anchor=”” class=”” id=””][two_third last=”no” class=”” id=””][/two_third][one_sixth last=”yes” class=”” id=””][/one_sixth][/fullwidth][fullwidth backgroundcolor=”” backgroundimage=”” backgroundrepeat=”no-repeat” backgroundposition=”left top” backgroundattachment=”scroll” bordersize=”0px” bordercolor=”” borderstyle=”” paddingtop=”px” paddingbottom=”px” paddingleft=”px” paddingright=”px” menu_anchor=”” class=”” id=””][aione_text]

Method 1

You can find many java script code snippets to disable right click. But jQuery makes our life easy. Below jQuery code disables the right click of mouse.

$(document).ready(function(){
    $(document).bind("contextmenu",function(e){
        return false;
    });
});

We just need to bind the contextmenu event with the document element.

Method 2

$(document).ready(function(){
    $(document).bind("contextmenu",function(e){
        e.preventDefault();
    });
});

[/aione_text][/fullwidth][one_sixth last=”yes” class=”” id=””][/one_sixth]

Leave a Reply

Your email address will not be published. Required fields are marked *