dinoslikeroar Posted November 2, 2016 Share Posted November 2, 2016 I'm stuck on getting the below code to work for a project I'm working on. Not sure if this is in the right location or not and if it isn't I apologize. I'm needing a yes/no option. If yes it will display certain options from them to choose from (NaYes) and if no is select it should display the campus options (NaNo). <form name="CoharieTribe"> <select id="coharietribe" id="second" class="package" title="Search in"size="1"> <option selected="selected">Are you a member or affiliated with the Coharie Tribe?</option> <option class="dropdown" value="yes">Yes</option> <option class="dropdown" value="no">No</option> </select> </form> <!-- Yes Option --> <form name="NaYes"> <select id="yes" class="searchSelect" title="Search in"size="1" onChange="goNaYes()"> <option selected="selected">Select Option</option> <option value="www.placeyourorderhere.com">I am a new student placing an order for the first time</option> <option value="www.placeyourorderhere.com">I am a returning student</option> <option value="www.placeyourorderhere.com">I need to renew my background check</option> <option value="www.placeyourorderhere.com">I need a drug test</option> </select> </form> <!-- No Option --> <form name="NaNo"> <select id="nurse" id="second" class="package" title="Search in"size="1"> <option selected="selected">Please select your campus:</option> <option class="dropdown" value="UNC">University of North Carolina</option> <option class="dropdown" value="UVA">University of Virginia</option> <option class="dropdown" value="CO">colorado University</option> </select> </form> Quote Link to comment https://forums.phpfreaks.com/topic/302446-help-with-prompt-option/ Share on other sites More sharing options...
cyberRobot Posted November 4, 2016 Share Posted November 4, 2016 (edited) Do you plan to use plain JavaScript, jQuery, etc.? With plain JavaScript, yYou can try something like the following: http://www.aspsnippets.com/Articles/Show-Hide-DIV-with-TextBox-based-on-DropDownList-Selected-Value-Selection-using-JavaScript-and-jQuery.aspx Of course, you may want to make some tweaks so the forms still work for visitors who have JavaScript disabled. You can do this by showing all the forms up front. Then use JavaScript to hide the content you don't want displayed until Yes or No is selected. Edited November 4, 2016 by cyberRobot Looking at the link again, it shows a plain JavaScript solution along with a jQuery version Quote Link to comment https://forums.phpfreaks.com/topic/302446-help-with-prompt-option/#findComment-1538933 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.