WishMeLz

生活其实很有趣

JS修改input的value触发change事件

 var inp = document.querySelector('input');
 var ev = new Event('input', { bubbles: true });
 ev.simulated = true;
 inp.value = 'new value'
 inp.dispatchEvent(ev);