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.
Example
try it in fiddle
$(function(){ //document.ready function $(document).on("contextmenu",function(e){ alert('right click disabled'); return false; }); });to disable right click in certain elements, you can give it a class/id and use respective selector.
Example
right click disable | right click |
right click | no right click |
Thanks the give script of disable right click is fully working for me.
ReplyDeleteBefore 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
Thanks