使用jQuery向<select>添加选项?添加option使用jQuery的下拉列表?这个能行吗?$("#mySelect").append('<option value=1>My option</option>');
3 回答

长风秋雁
TA贡献1757条经验 获得超7个赞
$("#selectList").append(new Option("option text", "value"));
var o = new Option("option text", "value");/// jquerify the DOM object 'o' so we can use the html method$(o).html("option text"); $("#selectList").append(o);

哆啦的时光机
TA贡献1779条经验 获得超6个赞
$('#select').append($('<option>', {value:1, text:'One'}));
$('#select').append('<option value="1">One</option>');
var option = new Option(text, value); $('#select').append($(option));
添加回答
举报
0/150
提交
取消