If you always have 3 options in the drop-down menu, you can simply change the parameter values:
var workers = ["Steve", "Nancy", "Dave"]; for(var i in workers) { $("#dropdown option").eq(i).html(workers[i]); $("#dropdown option").eq(i).val(workers[i]); }
If you also want to change the number of parameters, you can delete all existing parameters and re-add all of them, for example:
var workers = ["Steve", "Nancy", "Dave"]; $("#dropdown select").empty(); for(var i in workers) { $("#dropdown select").append('<option value='+i+'>'+workers[i]+'</option>'); }
source share