Disable paste option in textbox
With the help of jQuery event.preventDefault() method we can disable paste in textbox.
It can be used in the situation where user enters his confirmation email id in registration form.
Reference : How can I disable Ctrl+V (Paste) option using jQuery in one of my input text fields
It can be used in the situation where user enters his confirmation email id in registration form.
$('#confirm-email').bind("paste",function(e) {
e.preventDefault();
alert('You cannot pase text into this textbox');
});
Some other events:
cut,copy,contextmenu(disables right click)It will prevent all the four actions ie., We cannot perform those 4 actions(cut, copy, contextmenu and paste) in 'confirm-email' field.
$('#confirm-email').bind("cut copy contextmenu paste",function(e) {
e.preventDefault();
});
Reference : How can I disable Ctrl+V (Paste) option using jQuery in one of my input text fields
Comments
Post a Comment