Ticket #5136 (closed bug: invalid)
change type of input field
| Reported by: | Sn3b | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.4 |
| Component: | core | Version: | 1.3.2 |
| Keywords: | input type password | Cc: | |
| Blocking: | Blocked by: |
Description
Hi, I tried to change the input type of a field from password to text. I saw many articles online actually remove the field and recreate it on the fly to accomplish that, which I don't understand...
Anyway, I thought a simple $("#field").attr("type", "text/password") would do, but it simply doesn't work where document.getElementById("field").type="text/password" works just fine.
Not sure if it's a bug, as I said most articles (and even my router's embedded website does the same for hiding/showing wifi key) remove the element and recreate it programmatically.
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

The behavior varies from browser to browser; I know IE won't let you change the type after it's been created so the only cross-browser way is to create a new element.