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   ·   5462 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 40ms · UTC 09:15 · PVG 17:15 · LAX 02:15 · JFK 05:15
♥ Do have faith in what you're doing.