jQuery: Best practice to populate drop down?

Andreas Grech was pretty close… it’s actually this (note the reference to this instead of the item in the loop):

var $dropdown = $("#dropdown");
$.each(result, function() {
    $dropdown.append($("<option />").val(this.ImageFolderID).text(this.Name));
});

Leave a Comment