Answers for "bind json data to dropdownlist using javascript"

0

bind json data to dropdownlist using javascript

// THE JSON ARRAY.
var birds = [
  {"ID": "001", "Bird_Name": "Eurasian Collared-Dove"},
  {"ID": "002", "Bird_Name": "Bald Eagle"},
  {"ID": "003", "Bird_Name": "Cooper's Hawk"},
];

var dropDown = document.getElementById('dropdown-id');
for (var i = 0; i < birds.length; i++) {
  // POPULATE SELECT ELEMENT WITH JSON.
  ele.innerHTML += '<option value="' + birds[i]['ID'] + '">' + birds[i]['Bird_Name'] + '</option>';
}
Posted by: Guest on July-12-2021

Code answers related to "bind json data to dropdownlist using javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language