JavaScript - validation in javascript - Asked By ramar yadav on 01-Oct-12 05:50 AM


copy paste the value does not allow in the text box using java script .

pls kindly help me.... 
Chintan Vaghela replied to ramar yadav on 01-Oct-12 06:40 AM

Hi Frndz,


Functionality:  Disable copy and paste for textbox



To achieve this task,



Use textbox oncopy and onpaste attribute



Check Below logic for more detail



Full Logic     :


protected void Page_PreRender(object sender, EventArgs e)


      TextBox1.Attributes.Add("oncopy", "return false;");

      TextBox1.Attributes.Add("onpaste", "return false;");



Hope this helpful!





Jitendra Faye replied to ramar yadav on 01-Oct-12 06:42 AM
Try this Jquery code-

   <script type="text/javascript">
    $(document).ready(function() {
    $('#TextBox1').bind('copy paste cut',function(e) {
    e.preventDefault(); //disable cut,copy,paste
    alert('cut,copy & paste Not Allowed');

    <asp:TextBox ID="TextBox1" runat="server" ></asp:TextBox>
Goniey N (Mr. G) replied to ramar yadav on 01-Oct-12 07:02 AM
Try this,,,

<input type="text" oncopy="return false;" onpaste="return false;" oncut="return false;">

For more refer link :

hope this will helpful to you...