设置 select 选中:
//默认选中第一个
$('#serviceCode option:eq(0)').prop('selected', 'selected');
背后原理:
设置属性和值:
$(selector).prop(property,value)
获取select 选中:
var option = $('#carStyleList option:selected');
设置 select 选中:
//默认选中第一个
$('#serviceCode option:eq(0)').prop('selected', 'selected');
背后原理:
设置属性和值:
$(selector).prop(property,value)
获取select 选中:
var option = $('#carStyleList option:selected');