www.webdeveloper.com
Results 1 to 3 of 3

Thread: Javascript type change.

Hybrid View

  1. #1
    Join Date
    May 2011
    Posts
    2

    Question Javascript type change.

    I am new to javascript and I tried to change the type of a input using js.My work works well with Firefox and Chrome but not with IE.IE javascript debug mode says:

    (SCRIPT256: Could not get the type property. This command is not supported. ).

    This is the code I used to change the type.

    Code:
    var email_type=document.getElementById("email");
        email_type.type='text';

    Please help me to debug this.
    Thanx.

  2. #2
    Join Date
    Feb 2011
    Posts
    231
    Hy,
    I'm not shure if it works, but try anyway:
    Code:
    var email_type=document.getElementById("email");
    email_type.setAttribute('type', 'text');

  3. #3
    Join Date
    Dec 2005
    Posts
    2,984
    IE doesn't allow you to change the type attribute of input elements. Unfortunately it's not possible to do so directly because of this.

    Workarounds always exist however....why not create a new input element with the new type attribute and replace the old input element with it when you need to?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles