Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Mar 2004
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    change type from hidden to text

    Hi there,

    got a function that's supposed to change the class and type of a element from hidden to text depending on user input.

    the initial element is hidden:
    <input name="newUcompanyVatNum" type="hidden" class="" id="newUcompanyVatNum" value="" size="40" maxlength="60">

    and I've got a function which to change the class, type:
    Code:
    document.getElementById('newUcompanyVatNum').className = "RequiredTextBox";	
    document.getElementById('newUcompanyVatNum').type = "text";
    it's changing the class, but not the type? ie is saying that
    Could not get the type property. this command is not supported
    Have I just got the syntax wrong? how do I change the type to text?

    Thanks in advance

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can't change the "type". If you want to display or hide a text element then make it a text element and change it's CSS DISPLAY property to hide or display it.
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #3
    New Coder
    Join Date
    Mar 2004
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks for that,

    just took a break from the 'tom hooter' and realised that I could do it another way, so now I'm not trying to change the type, but using
    Code:
    <span id="vatBox">&nbsp;</span>
    and the following javascript to change it into a text box
    Code:
    document.getElementById('vatBox').innerHTML ="<input name=\"newUcompanyVatNum\" type=\"text\" class=\"\" id=\"newUcompanyVatNum\" value=\"\" size=\"40\" maxlength=\"60\">";


  •  

    Posting Permissions

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