Does anyone know of a technique to programmatically create an HTML select list including options using JQuery?
Here's a variation - based on previous answers in this thread - where all but the select-input options can be specified via an input JSON object:
Would be interesting to see if the options array can somehow be specified in that JSON input?
var fruitListProfile = {
id : someKey,
class : 'fruit_list',
style : 'margin-right: 20px; '
};
var selectInput = $('', fruitListProfile);
var fruitOptions = ['apple', 'cherry', 'kiwi'];
for (var i in fruitOptions) {
selectInput.append($('').html(fruitOptions[i]));
}