So I want to expand my form in different ways depending on the selection of a drop down box.
I have got my javascript job so that when I change my selection it will do some work. But I'm trying to use the appendTo () method as I did before; To add an input, to apply a single device and to work for some input it is not working, so post;)
So were you hoping that people would better me Can you understand the way?
Here is my current code (Courtesy of Mark):
var selectmenu = document.getElementById ("type"); Selectmenu.onchange = function () {var selectoption = parseInt (this option [this.selectedIndex] .value); Switch (option selected) {Case 1: $ ('' ) AppendTo ('# temp'); break; Case 2: $ ('& lt; Input type = "article" value = "2" />) AppendTo ('# temp'); break; Case 3: $ ('& lt; Input type = "article" value = "3" />) AppendTo ('# temp'); break; }}; Note: Updated since the answer.
here
It's nothing to be built.
Please help? : D
I think the value on which you are trying to get the case is not a string < / P>
Try it
$ (document) .ready (function () {$ ('# type'). Change (function () {if ($ (this) Val ()! = "Nothing") {switch ($ (this) .val ()) {case "1": $ ('& lt; input type = "article" value = "item1" />). AppendTo ("Case" 2 ": $ ('& lt; Input type =" article "value =" item 2 "/>').appendTo('#temp'); break; case" 3 ": $ (' & Lt; input type = "text" value = "item 3" / & gt;) .appendTo ('# temp'); break;}} else {alerts ($ (this) .val ());}}); })
Comments
Post a Comment