by: Saravanan Arumugam
Page views:
2233


jQuery has been a blessing for web developers because it's really very easy to use. We don't need to write complex javascript code to achieve simple task. Here's the simple jQuery script that used to disable Right click in a page.

Here I have used alert message for testing purpose, it's good to avoid alert message like we are disabling right click.

<html>

<head>

<title>Disable Right Click using jQuery</title>

<script src="http://code.jquery.com/jquery-1.9.1.js" type="text/javascript"></script>

<script type="text/javascript">

$(function () {

$(this).bind("contextmenu", function (e) {

e.preventDefault();

alert('Sorry, this functionality is disabled!');

});

});

</script>

</head>

<body>

Disable Right Click using jQuery

</body>

</html>


Please subscribe, if you want to get email updates (it's free).



Comments
comments powered by Disqus
Subscribe via Email
    
message to display in fancybox