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   ·   2880 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 12ms · UTC 14:51 · PVG 22:51 · LAX 07:51 · JFK 10:51
♥ Do have faith in what you're doing.