select 切换选中 关键词 prop(),不能用attr()
html 部分
<div class="form-group">
<label class="col-lg-2 control-label" style="width: 110px;height: 34px;line-height: 34px;">  合同 :</label>
<div class="col-lg-4">
<select style="margin-right:15px;" name="type" id="type" class="form-control" onchange="change($(this))">
<option value="">请选择</option>
{loop $htlist $v}
<option value="{$v['id']}" >[{$v['name']}] {$v['tid_name']}</option>
{/loop}
</select>
</div>
<label class="col-lg-2 control-label" style="width: 110px;height: 34px;line-height: 34px;">业务员:</label>
<div class="col-lg-4">
<select style="margin-right:15px;" name="teacher" id="teacher" class="form-control" onchange="change_2($(this))">
<option value="">请选择</option>
{loop $tclist $tv}
<option value="{$tv['id']}" >{$tv['tname']}</option>
{/loop}
</select>
</div>
</div>
js
//---------------监听select1
function change(e) { //选择合同模板
// $("#teacher").find("option").attr("selected",false);
$.ajax({
url: "{php echo $this->createWebUrl('receipt',array('schoolid' =>$schoolid,'mt' =>'select'))}",
data: {htid: e.val()},
type: 'post',
async: false,
success: function(res) {
rlt = JSON.parse(res);
$("#teacher").find("option[value="+rlt.result.tid+"]").prop("selected",true);
},
});
}
