Jump to content

JavaScript form drop down menu help


svgmx5

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.