Jump to content

Internet Explorer "type" Property


The Little Guy

Recommended Posts

I have a text field, and when a user clicks on it, it turns into a password field.

to accomplish this, I have this in an onfocus method in the input:

 

<input type="text" onfocus="this.type='password';" value="Password" />

 

This works perfectly fine in Firefox, but in Internet Explorer, I have an error message saying:

Could not get the type property. This command is not supported.

 

How can I fix this in Internet Explorer?

Link to comment
Share on other sites

I remember trying to do the same thing ago a long time back. Forget what I did then, but one workaround would be to use two separate fields and use the display property to make it look like it's changing to a password field.

 

function showPW()
{
    document.getElementById('pwText').style.display = 'none';
    pwField = document.getElementById('pwPWord');
    pwField.style.display = '';
    pwField.focus();
    pwField.select();
}

 

<input id="pwText" type="text" onfocus="showPW();" value="Password"
/><input  id="pwPWord" type="password" value="Password" style="display:none;" />

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.