Skip to content Skip to sidebar Skip to footer

Javascript Ie6/7/8 Change Input Type

The following javascript snippet will change the type of an INPUT, for instance from text to password. It's being used to allow users to display their password on-screen when typin

Solution 1:

Type is read-only in Internet Explorer (at least 6, anyway), so it's just not directly possible. As a workaround, I've had a hidden input field of the type I wanted, then when I need to switch the type, hid the old one and made the other one visible. Not as clean, but unfortunately just changing the type as far as I know isn't possible.

An alternative method would be to use the JavaScript DOM to replace the field with the replaceChild function of a node.

Post a Comment for "Javascript Ie6/7/8 Change Input Type"