The following javascript doesnt work in IE9, but works fine in Firefox. Any idea how to solve this? Thx.
var element = e.srcElement || e.target;
if(element != null){
if(element.tagName == "INPUT") {
//alert("Before: " + element.getAttribute("type"));
element.setAttribute("type", "password");
//alert("After: " + element.getAttribute("type"));
}
}
Since I’ve found that a plausible solution is to replace the element with a new one, you could use something like this:
Found here http://bytes.com/topic/javascript/answers/705445-dynamically-change-input-type-text-password and modified slightly. Another solution off there is to use
createElementinstead of cloning, but that might take some more work.EDIT:
Forgot to mention that the problem seems to be that IE does not like changing the
typeattribute of an element dynamically after it has been included in the DOM.