I think this is a simple answer but definitely the best way and I'm new to the form.
I want a drop-down list with model numbers. When a certain model number is selected, it displays a form with properly named input.
For example
Model 1 - When selected - Input Field 1 and Input Field 2 displays
Model 2 - When selected - Displays input field 1 and input field 2 and input field 3
Model 3 - When selected - input field 1 and input field 4 and input field 5 displays
It should be dynamically.
Or link to me on the tutorial or example site
thanks
HTML
& lt; Select ID = "myselect" & gt; & Lt; Option value = "model 1" & gt; Model 1 & lt; / Options & gt; & Lt; Option value = "model2" & gt; Model 2 & lt; / Options & gt; & Lt; / Select & gt; & Lt; Div id = "form1" class = "forms" & gt; Form 1 content & lt; / Div & gt; & Lt; Div id = "form2" class = "forms" & gt; Form 2 content & lt; / Div & gt; jQuery
$ (function () {$ (".forms"). Hide (); $ (" # Myselect "). Change (function () (switch ($ (this) .val ()) {Case" Model 1 ": $ (" .form "). Hide (). Parent (). (" #Form 1 ("# form2"). Show (); break;}});} (".2 format").); See examples on jsFiddle:
Comments
Post a Comment