jquery - How to replace the onpaste function in javascript? -


an input element on web page defined following prevent passwords being pasted in:

<input type="password" class="field" id="password" name="password" title="enter password" maxlength="50" onpaste="javascript:return false;" size="38" tabindex="2"> 

i want enable pasting in input field. using firebug or equivalent can edit onpaste function code is:

onpaste="javascript:return true;" 

this fine me, other users, want simpler solution. came mind if give them javascript, open console , paste in simple one-liner. when tried javascript had no effect. tried following , neither worked.

$('#password').onpaste="" $('#password').onpaste="javascript:return true;" 

what doing wrong?

the problem you're trying combine jquery regular javascript. can use pure javascript remove onpaste listener.

document.getelementbyid('password').onpaste="" 

if want use jquery instead, can use:

$('#password')[0].onpaste="" 

which give same result.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -