jQuery Disable Mouse Right Click Examples

jQuery Disable Mouse Right Click Examples

Today, We want to share with you jQuery Disable Mouse Right Click Examples.In this post we will show you How to Disable Mouse Right Click using jQuery, hear for how to disable right click in html using javascript we will give you demo and example for implement.In this post, we will learn about write a code to disable right click menu in html page using jquery with an example.

jQuery Disable Mouse Right Click Examples

There are the Following The simple About jQuery Disable Mouse Right Click Examples Full Information With Example and source code.

As I will cover this Post with live Working example to develop disable right click on iframe using jquery, so the disable right click javascript for this example is following below.

Disable mouse right click, cut, copy and paste using jQuery

Disable Mouse Right Click

<script type="text/javascript">
$(document).ready(function () {
    //Disable full page
    $("body").on("contextmenu",function(e){
        return false;
    });
    
    //Disable part of page
    $("#id").on("contextmenu",function(e){
        return false;
    });
});
</script>

jQuery Disable Cut Copy & Paste

<script type="text/javascript">
$(document).ready(function () {
    //Disable full page
    $('body').bind('cut copy paste', function (e) {
        e.preventDefault();
    });
    
    //Disable part of page
    $('#id').bind('cut copy paste', function (e) {
        e.preventDefault();
    });
});
</script>

jQuery – Disable Mouse Right Click, Cut, Copy & Paste

<script type="text/javascript">
$(document).ready(function () {
    //Disable cut copy paste using jQuery Example
    $('body').bind('cut copy paste', function (e) {
        e.preventDefault();
    });
   
    //Disable mouse right click
    $("body").on("contextmenu",function(e){
        return false;
    });
});
</script>

jQuery – Disable Right Click Context Menu

jQuery disable the right-click event

<script type="text/javascript">
$(document).ready(function(){
    $(this).on('contextmenu', function(e){
        e.preventDefault();
    });
});
</script>

part of the web page disable right click

<script type="text/javascript">
$(document).ready(function(){
    $('#myDivid').on('contextmenu', function(e){
        e.preventDefault();
    });
});
</script>

Whole Web page disable right click context menu in jQuery

<script type="text/javascript">
$(document).ready(function(){
    $(this).on('contextmenu', function(e){
        if(e.target.nodeName != "TEXTAREA"){
            e.preventDefault();
        }
    });
});
</script>

Disable Cut, Copy & Paste on Webpage:

Disable CTRL+X (cut), CTRL+C (copy), CTRL+V (paste).

<script type="text/javascript">
$(document).ready(function(){
    $(this).on('cut copy paste', function(e){
        return false;
    });
});
</script>

specific page elements(disable cut, copy and paste)

<script type="text/javascript">
$(document).ready(function(){
    $('#code').on('cut copy paste', function(e){
        return false;
    });
});
</script>

Angular 6 CRUD Operations Application Tutorials

Read :

  jQuery Ajax Get JSON in Laravel Example

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about jQuery Disable Mouse simple Right Click Examples.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Reply

avatar
  Subscribe  
Notify of