通过按钮重置表单时select的处理

    html:            

                <select  id="VipSource" name="VipSource"  data-placeholder="会员来源" > 
<option value="">--全部--</option>
<option value="1" <c:if test="${pd.VipSource == '1' }">selected</c:if> >会员库</option>
<option value="2" <c:if test="${pd.VipSource == '2' }">selected</c:if> >小程序注册</option>
                </select>



js代码:

function reset()

                {

                          //1、先把重置后的值赋给select对象;2、通过trigger出发change事件

                         $("#VipSource").val("").trigger('change');

}

猜你喜欢

转载自blog.csdn.net/chenbhhh/article/details/79479216