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 5 of 5
  1. #1
    New Coder
    Join Date
    Jun 2010
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts

    show hide text box

    Hi

    Im looking for a way to show hide text box on select option change

    PHP Code:

    <select name="letter_type" id="lt">
                        <
    option value="Registered">Registered</option>
                        <
    option selected="selected" value="Unregistered">Unregistered</option></select>
                        <
    input name="textfield7" id="regty" type="text" accesskey="1" tabindex="1" size="20" /> 
    i wana show that text box if user select "Registered" from select option.

    any help would be great



    sorry for language errors.

    Thanks

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,037
    Thanks
    203
    Thanked 2,539 Times in 2,517 Posts
    Here you are:-

    Code:
    <select name="letter_type" id="lt" onchange = "show()"> 
    <option value="Registered">Registered</option> 
    <option selected="selected" value="Unregistered">Unregistered</option>
    </select> 
    <br><br>
    <div id = "mydiv"  style="display:none">
    <input name="textfield7" id="regty" type="text" accesskey="1" tabindex="1" size="20" />  
    </div>
    
    <script type = "text/javascript">
    
    function show() {
    var val = document.getElementById("lt").value;
    if (val == "Registered") {
    document.getElementById("mydiv").style.display="block";
    }
    else {
    document.getElementById("mydiv").style.display="none";
    }
    }
    
    </script>
    Quizmaster: Which animal do we get vension from?
    Contestant: Snakes.

  • #3
    New Coder
    Join Date
    Jun 2010
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks a lot

  • #4
    New Coder
    Join Date
    Jun 2010
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks a lot

  • #5
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,037
    Thanks
    203
    Thanked 2,539 Times in 2,517 Posts
    WWhhaatt ddooeess dduupplleexx mmeeaann??


  •  

    LinkBacks (?)


    Posting Permissions

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