Is it possible to dynamically pass information from a dynamically created option dropdown list. All the Option’s are created from a JSON call. The end goal would be to pass the ID to another JSON call to retrieve data. I’m currently using a switch based on each id#…would that be the only way?
HTML:
<option id="-1">DEVELOPER GROUP</option>
The numbers increase up to 5 for now but we are adding more groups daily
JS:
$("#fDistList").change(function () {
var id = $(this).find("option:selected").attr("id");
switch (id) {
case "-1":
console.log("Developer Group has been selected");
break;
You could set the
valueof the options to the value you want to pass to the other call.Then all you’d have to do is
Assuming
#fDistListis you select.