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