I want to change the input type to password when I click on it. I tried this:
<input name="pin" id="cp_serv" type="text" class="pin_v" value="Insert PIN Please" onclick="this.value='';$(this).attr('type','password');"/>
I tried to use the jQuery function attr
to change this on the click
event, but nothing is happening.
Is this the right way to do it or is this possible?
26ph19
jquery.Attr
should work the way that you want:
UPDATE
This one when you click on it:
来源:https://stackoverflow.com/questions/18539052/transform-input-type-text-to-password