tags:

views:

59

answers:

2

Hello.

I'm making a "show password" button for password input. Problem that is browsers don't allow to change attribute 'type'. Ok, i'm cloning this element with jquery's clone() function and change this attribute "in memory". It works in all 'normal' browsers, but not in IE. Then i'll try to copy html, replace 'password' to 'text', save the value and append back. It works in all browsers. But my original object have binded events and additional data.

How to copy object with all properties (like it does clone()) and change attribute? How to solve this problem?

+2  A: 

you might just not trying to change the actual attribute that defines it as a password element. Instead, put a hidden text field there. The show password button can hide the password field and show the text field, and copy the value of the password field into the text field.

Brian Schroth
A much simpler solution.
peacedog
it is not problem. i wrote this. the problem is how to copy all properties (event listeners and data) of original object (password input) to dublicate text input.
Chupa
A: 

You have to create an "input type text" and by seeing the key, you have to show the "input type text" and copy the value of "input type password"

andres descalzo