houssam_ballout Posted April 9, 2013 Share Posted April 9, 2013 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 More sharing options...
jeffman Posted April 9, 2013 Share Posted April 9, 2013 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 More sharing options...
houssam_ballout Posted April 10, 2013 Author Share Posted April 10, 2013 Is there any example available to help me Link to comment Share on other sites More sharing options...
jeffman Posted April 10, 2013 Share Posted April 10, 2013 This example does something similar. Link to comment Share on other sites More sharing options...
houssam_ballout Posted April 10, 2013 Author Share Posted April 10, 2013 I meant, when I select an item from the dopdown it will show 2 textboxes, and when I select another dropdown it will hide those 2 textboxesThanks Link to comment Share on other sites More sharing options...
jeffman Posted April 10, 2013 Share Posted April 10, 2013 I know what you want. I'm trying to help you do some of the work yourself. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now