I have an input type password that I want to change to text when an immage is clicked.
This is what I did:
$('#txtGenerate').attr("type", "text");
But it's not working.. What can I do?
try this:
$('#txtGenerate').prop('type', 'text');
.attr?Use prop instead:
$('#txtGenerate').removeAttr("type");
$('#txtGenerate').prop('type', 'password');
inputelement. You should consider replacing the password input with a text input instead. From the.attrdocumentation (which you read, right?): "Note: Attempting to change thetypeattribute (or property) of aninputelement created via HTML or already in an HTML document will result in an error being thrown by Internet Explorer 6, 7, or 8."