Home > DeveloperSection > Forums > prevent copy past in textbox using jquery!
lois waisbrooker
lois waisbrooker

Total Post:70

Points:494
Posted on    March-05-2013 4:40 AM

 JavaScript JavaScript 
Ratings:


 1 Reply(s)
 1005  View(s)
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!



AVADHESH PATEL

Total Post:604

Points:4228
Posted on    March-05-2013 8:10 AM

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>


Don't want to miss updates? Please click the below button!

Follow MindStick