Wednesday, 19 November 2014

With JSON how to populate combobox

//Populate combobox through map
function populateCombobox(data,elementId){
var options = "<option value=-1>Select..</option>";
$.each(data, function(key, value) {
  options += "<option value="+key+">"+value+"</option>";
});
$(elementId+' option').remove();
$(elementId).append(options);
}

No comments:

Post a Comment