I want to display values by selecting different nested JSON Object by using Jquery.
Here is the link http://jsfiddle.net/036easd8/8/
var firstSelect = $('<select id="firstSelect"><option >Select</option></select>');
var secondSelect = $('<select id="secondSelect"> </select>');
var ThirdSelect = $('<select id="ThirdSelect"> </select>');
$.each(data, function(item, key) {
firstSelect.append('<option >' +item+ '</option>');
});
$("#container").html(firstSelect);
$("#firstSelect").on("change", function(e) {
var item;
var selected = $(this).val();
if (selected === "BFS-Retail") {
item = data[selected];
} else {
item = data[selected];
}
$(secondSelect).html(data[selected]);
$.each(item, function(item, key) {
secondSelect.append('<option >' + item + '</option>');
});
});
$("#container").append(secondSelect);
$("#secondSelect").on("change", function(e) {
var item1;
var selected = $(this).val();
if (selected === "Others") {
item1 = data[selected];
} else {
item1 = data[selected];
}
$.each(item, function(item, key) {
ThirdSelect.append('<option >' + item + '</option>');
});
});
$("#container").append(ThirdSelect);
});
When I select "Other" from 2nd dropdown list then, in 3rd dropDown list not displaying the another JSON object. When i select "Industries" then Value should be display in textbox or any content Can any one provide me the proper solution for these issue