Skip to content

Instantly share code, notes, and snippets.

@EdCharbeneau
Created October 3, 2013 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EdCharbeneau/6810137 to your computer and use it in GitHub Desktop.
Save EdCharbeneau/6810137 to your computer and use it in GitHub Desktop.
The correct way to add items to an Html drop down list using jQuery.
optionsToAdd.forEach(function (item) {
$("<option></option>")
.html(item.myText)
.attr("value", item.myId)
.appendTo($("#targetDropDown"));
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment