This code below works in all web browsers except IE
:
You cannot dynamically change a the type of an input element in Internet Explorer.
One possible workaround would be to:
You may want to check the following article for a JavaScript implantation of the above:
Another option would be to statically create the two elements, but having only one visible at a time. The visibility and the focus would depend on the value of the elements. In this case, you may want to use something like this: