Home > ASP.Net, Jquery > JQuery to disable Copy, Paste, Cut and Drop

JQuery to disable Copy, Paste, Cut and Drop

Hi all,

try this example to use JQuery to disable Cut, Copy, Paste and Drop options

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <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;
 <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 />

Hope this helps

Good Luck.

Categories: ASP.Net, Jquery
  1. No comments yet.
  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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: