Wednesday, July 16, 2014

Disable right click on image using jQuery

In this article i am going to explain how to disable right click on image using jQuery.Disable right click function is used to avoid copying images,websites and codes.


Live DemoDownload Script


contextMenu is used to trigger contextMenu with right-click, left-click, hover or own custom trigger events.
   
    Step 1:
    Need library function.Just copy and paste the below library file.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>

jQuery Function

$(function() {
        $('img').bind("contextmenu", function() { //It works for all img tags.
            return false
        });
    });

HTML code for disable right click

 <img src="your-img.jpg" alt="img" />

Please share your comments and feedback.Thanks.Please subscribe my updates via email.

No comments:

Post a Comment