Jump to content

show 2 texbox on dropdown box


houssam_ballout

Recommended Posts

Hello,i had the following scenario in which I need your help: I had a drop down box: <option value="client-all.php">1</option><option value="supplier-all.php">2</option><option value="koshofat.php">3</option> <input type="button" onClick="location=document.koshofat.URL.options[document.koshofat.URL.selectedIndex].value;" value="go" class="button2"> its good for 1, 2 , but I need to show 2 textboxes when the user select 3 and hide them when user select different than 3 (After that when he click submit, I will get the values through POST variables), I need your help in scripting my issue? Thanks in advance

Link to comment
Share on other sites

1. Write a function that captures the select element's onchange event. 2. The function gets the selected index. If the index is 0 or 1, hide the textareas. If the index is 2, show the textareas. 3. There are two ways to change visibility. 3a. Change the CSS display property of the textareas (or a div that contains both of them).Use display:none to hide something. Use display:block or display:inline (or any other value) to make it visible. 3b. Change the CSS visibility property. Usevisibility:hidden to hide something. Use visibility:visible to make it visible. Try both. Changing visibility has a very different effect than changing display.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...