Here is my requirement.
List item
- I have a couple of dropdowns A and B
- I have a javascript key-value variable created:
var keyvalue={"key1":["value1","value2"],"key2":["value2","value4"]}
I am populating the keys in dropdown A, on selecting this dropdown, i am populating the corresponding values (froom the keyvalue variable) into the drop down B
Here is the sample code i a using :
The problem is even if i select a different option in dropdown A, the corresponding old option is present in the new drop down,i.e, new values are appended, rather than creating a new drop down Any help is appreciated,thanks in advance.
.remove()
the children first,.replaceWith()
or.html()
for jquery. – Francisco Presenciabody
, you can actually remove lines, "$( document ).ready(function() {" and it's closing, "})". Then you'll be running completely native :) and can drop some dead weight and remove your jQuery<script>
reference all together. – kmatheny