Jonatvtwoex

Jonatvtwoex

V2EX member #284470, joined on 2018-01-19 16:08:52 +08:00
Jonatvtwoex's recent replies
原因是校验逻辑依赖 input 事件, 而 inputEle.value = xxx 并不会触发 input 事件

const inputEle = document.querySelector(`input[name=${key}]`)
inputEle.value = fields[key]
// 关键代码: input 元素在事后触发一下 input 事件
inputEle.dispatchEvent(new Event('input'));
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3080 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 11ms · UTC 13:52 · PVG 21:52 · LAX 06:52 · JFK 09:52
♥ Do have faith in what you're doing.