Skip to main content

Dynamically adding options to a select tag using jQuery

The Best way to add options to an existing select tag using jQuery is

$.each(selectValues, function(key, value) {   
     $('#mySelect')
         .append($("")
         .attr("value",key)
         .text(value)); 
});

Comments