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
    Apr 2005
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Show/hide dropdown based on choice

    Ok i need some simple code, I hope someone can help me out.

    I've got the following dropdown:
    Code:
    <select id="abonnement" name="abonnement">
        <option value="">Selecteer soort</option>
        <option value="los">Los toestel</option>
        <option value="icm">Toestel icm abonnement</option>
    </select>
    If option "Los toestel" is chosen, I want to hide the following dropdown, and when "Toestel icm abonnemnt is chosem I want to display the following dropdown.

    Code:
    <select id="provider" name="provider">
        <option value="">Selecteer een provider</option>
        <option value="">Maakt niet uit</option>
    </select>
    Thanks in advance,
    Yorick

  • #2
    Regular Coder
    Join Date
    Oct 2003
    Posts
    603
    Thanks
    2
    Thanked 1 Time in 1 Post
    Code:
    <script type="text/javascript">
    function ChangeDropdowns(value){
    if(value=="los"){
    document.getElementById('provider').style.display='none';
    }else if(value=="icm"){
    document.getElementById('provider').style.display='block';
    }
    }
    </script>
    <select id="abonnement" name="abonnement" onchange="ChangeDropdowns(this.value);">
        <option value="">Selecteer soort</option>
        <option value="los">Los toestel</option>
        <option value="icm">Toestel icm abonnement</option>
    </select>
    <select id="provider" name="provider">
        <option value="">Selecteer een provider</option>
        <option value="">Maakt niet uit</option>
    </select>

  • #3
    New Coder
    Join Date
    Apr 2005
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It works great! Thanks !


  •  

    Posting Permissions

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