Introduction:

In this article today I will
explain how we can disable copy, cut, paste and drag-drop options in
asp.net text
box using Jquery
Source Code:
Create a web form and add following
script in head tag.
<script type="text/javascript"src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
$('.disable').bind('cut copy paste drop', function (e) {
e.preventDefault();
alert('Cut,Copy,Drop and Paste
options are disabled');
});
});
</script>
Design page as given below:
<fieldset style="width:400px;height:auto;align:center;">
<legend>Disable Copy-Paste and Drag-Drop</legend>
<table>
<tr><td>Address</td><td><asp:TextBox ID="txtaddress"CssClass="disable" TextMode="MultiLine" runat="server"></asp:TextBox></td></tr>
<tr><td></td><td>Dummy Text</td></tr>
</table>
</fieldset>
0 comments:
Post a Comment