PREVENT COPY PAST IN TEXTBOX USING JQUERY!

lois waisbrooker

Total Post:70

Points:494
Posted by  lois waisbrooker
 1415  View(s)
Ratings:
Rate this:

Hi Everyone!

I have working on asp.net login application using c#. I want to prevent copy and paste functionality in password textbox that support all latest browser!

Thank in advance!

  1. AVADHESH PATEL

    Post:604

    Points:4228
    Re: prevent copy past in textbox using jquery!

    Hi Lois!

    You can try this way!

    <html>
    <head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
    </script>
    <script language="javascript" type="text/javascript">
    $(document).ready(function () {
    $("#txtProductQty").bind('copy paste', function (e) {
                e.preventDefault();
            });

    $("#txtProductQty").val("1");
    });
    </script>
    </head>
    <body>
    <input type="text" id="txtProductQty"/>
    </body>
    </html>

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!