Код: Выделить всё
$('#').click(function () {
var myOptions = {
val1: 100,
val2: 'text2'
};
$('#').append(new Option(myOptions.val2, myOptions.val1));
});
Код: Выделить всё
$('#').click(function () {
var mySelect = $('#');
var myOptions = {
val1: 100,
val2: 'text2'
};
$.each(myOptions, function(val, text) {
$('#').append( new Option(text,val) );
});
});
Код: Выделить всё
$('#').click(function () {
var mySelect = $('#');
var myOptions = {
val1: 100,
val2: 'text2'
};
$.each(myOptions, function(val, text) {
mySelect.append(
$('').val(val).html(text)
);
});
Подробнее здесь: https://stackoverflow.com/questions/171 ... ith-jquery
Мобильная версия