0
我使用我在网上找到的一些代码成功填充下拉列表。
我的问题是这样的,我需要下拉菜单也有另一个选项“其他”。
我将如何修改下面的脚本来实现这一目标?使用jquery填充下拉列表
function populatemodelName()
{
$.getJSON('modules/car_sales/getcarmodels.php'
, {makeName:$('#makeName').val()}, function(data) {
var select = $('#modelName');
var options = select.attr('options');
$('option', select).remove();
$.each(data, function(index, array) {
options[options.length] = new Option(array['MODEL']);
});
});
}
$(document).ready(function() {
populatemodelName();
$('#makeName').change(function() {
populatemodelName();
});
});
感谢那吉米! – Peter 2011-05-04 21:43:55