Home > ASP.Net, Jquery > JQuery to prevent Cut , Copy , Paste and Drop options in Textbox

JQuery to prevent Cut , Copy , Paste and Drop options in Textbox


Hi all,

try this example to use JQuery to prevent Cut , Copy , Paste and Drop options in Textbox

<head>
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
var controls = $(".disable");
controls.bind("paste", function () {
return false;
});
controls.bind("drop", function () {
return false;
});
controls.bind("cut", function () {
return false;
});
controls.bind("copy", function () {
return false;
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
ASP.Net<br />
<br />
<asp:TextBox ID="TextBox2" runat="server" CssClass="disable"></asp:TextBox><br />
<br />
<asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" CssClass="disable"></asp:TextBox><br />
<br />
<br />
</form>
</body>

Hope this helps

Good Luck.

Advertisements
Categories: ASP.Net, Jquery
  1. April 5, 2014 at 11:42 am

    Reblogged this on modyrefay.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: