jquery操作select

var checkValue=$("#select_id").val();  //获取Select选择的Value
$("#select_id").val(4);   //设置Select的Value值为4的项选中
$("#select_id").val(4).change();  //触发change事件


1)Adding a single option - by appending HTML
$('#example').append('<option value="foo" selected="selected">Foo</option>');

2)Adding a single option - by appending a new option
var options = $('#example').attr('options');
options[options.length] = new Option('Foo', 'foo', true, true);

你可能感兴趣的:(jquery,select)