I have two textboxes, and I want to prevent user from copying the value from the first (email) textbox and pasting it in the second (confirmEmail) textbox.
Email: <input type="textbox" id="email"><br/> Confirm Email: <input type="textbox" id="confirmEmail">
I have two solution in my mind:
Any idea about how to do it?
http://jsfiddle.net/S22ew/
Use KeyPress, KeyUp, KeyDown for the same... <asp:TextBox onkeypress="return false;" onkeyup="return false;" onkeydown="return false;" ... You can use javascript key events for this. Use KeyPress, KeyUp, KeyDown for the same...
Projects In JavaScript & JQuery To disable cut, copy and paste of a content in jQuery, use the jQuery bind() function.
Check this fiddle.
$('#email').bind("cut copy paste",function(e) { e.preventDefault(); });
You need to bind what should be done on cut, copy and paste. You prevent default behavior of the action.
You can find a detailed explanation here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With