$("#optionsId").change(function(){ $("#selectOptionsText").val('测试'); });
$("#selectOptionsText").on('change',function(){});
目的:当#optionsId改变时触发#selectOptionsText的change事件实现某功能
发现并不能触发change事件,这篇博客中提供了一些方法,可做参考,但个人觉得不方便
经研究发现,可以手动触发blur事件达到效果
$("#optionsId").change(function(){
$("#selectOptionsText").val('测试');
$("#selectOptionsText").blur();//手动失去焦点
});
$("#selectOptionsText").on('blur',function(){});//触发blur事件