CHROME扩展开发之·input模拟输入用户输入(触发事件响应数据同步)
- 获取input dom
- 赋值并促发事件
const iptDom = document.querySelector('input')
iptDom.value = 'hello world!';
iptDom.dispatchEvent(new Event('input', { bubbles: true }));
const iptDom = document.querySelector('input')
iptDom.value = 'hello world!';
iptDom.dispatchEvent(new Event('input', { bubbles: true }));