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