svgmx5 Posted June 24, 2010 Share Posted June 24, 2010 Not sure how to start this, but i'm hopping someone here can help me out. What i'm trying to do is to display a <div> box when the user clicks an option from the drop down menu on a form. So if user selects cars from drop down, then i want a my div box that contains all the cars to show so they can select whatever car and submit the form. I've been trying to do this with jquery, but not sure how i can do it. Hoping someone here has done this before or can just give me a hand on how to get started. Link to comment https://forums.phpfreaks.com/topic/205796-javascript-form-drop-down-menu-help/ Share on other sites More sharing options...
thewooleymammoth Posted June 24, 2010 Share Posted June 24, 2010 <select> <option onfocus='jsFunction('car1')'>car1</option> <option onfocus='jsFunction('car2')'>car2</option> <option onfocus='jsFunction('car3')'>car3</option> <option onfocus='jsFunction('car4')'>car4</option> </select> JK, Im not sure i understand your problem Link to comment https://forums.phpfreaks.com/topic/205796-javascript-form-drop-down-menu-help/#findComment-1076920 Share on other sites More sharing options...
svgmx5 Posted June 24, 2010 Author Share Posted June 24, 2010 its okay.. what i have is a form, and there is a drop down selection in that form. So when a user selects an option from that drop down, a div box containing more information displays below it... I'm trying to work with something like this http://anthonygthomas.com/2010/03/14/display-form-fields-based-on-selection-using-jquery/ I'm using his example, but nothing is happening Here's my code <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ $("#select1").change(function(){ if ($(this).val() == "1" ) { $("#hide1").slideDown("fast"); //Slide Down Effect } else { $("#hide1").slideUp("fast"); //Slide Up Effect } }); }); </script> And here's the form <form method="post" action=""> <select name="select1" id="select1"> <option value="">Select</option> <option value="1">cars</option> </select> <div id="hide1" style="display:none"> <h1>Hello World</h1> </div> </form> Link to comment https://forums.phpfreaks.com/topic/205796-javascript-form-drop-down-menu-help/#findComment-1076925 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.