Jump to content

Change text field type


The Little Guy

Recommended Posts

I don't think IE likes changing input types, so you'll have to replace the current text input object with a newly generated password input object.  Something like this:

 

function replaceInput(oldInput){
  var newInput=document.createElement('input');
  newInput.setAttribute('type','password');
  newInput.setAttribute('name',oldInput.getAttribute('name'));
  oldInput.parentNode.replaceChild(newInput,oldInput);
  newInput.focus();
}

 

Thing is, IE doesn't seem to put the focus on the new password input.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.