Monday, October 21, 2013

Jquery to Prevent Cut, Copy and Paste for Textbox in

1 comment
Jquery code to prevent cut , copy or paste for text box control in can be used in situation where you don't want user to paste the text directly into input control. Suppose you have applied validation on text box to accept only numerics or alphabets as input but user can manually paste in that particular control and there would  be no use of validation. In such case use the jquery to prevent user manually copy and paste data inside an input control.

Jquery to stop Cut, Copy and Paste in ASP.Net:

<html xmlns="">
<head runat="server">
    <script src="//"></script>
    <script type="text/javascript">
        $(document).ready(function () {

            $('#txtname').bind("cut copy paste", function (e)
                alert("Cut, Copy not allowed");


    <form id="form1" runat="server">
            <asp:TextBox runat="server" ID="txtname"></asp:TextBox>


1 comment: