react JSX:
<input
type="password"
name="password"
value={this.state.password}
minLength={2}
maxLength={4}
required="required"
onChange={e => this.handleOnChange(e)}
placeholder="Password"/>
处理程序:
handleOnChange = (e) => {
console.dir(e.target)
console.dir(e.target.minLength) // ==> expected value is 2, but undefined
console.dir(e.target.maxLength) // ==> 4
在 Chrome 中,我能够找到“minLength”。但在 Safari 中,缺少“minLength”的键值对。
“maxLength”确实存在。
我没有掌握这个问题,Safari 没有实现“minLength”吗?
版本:
- Safari 9.1.1 (11601.6.17)
最佳答案
不,Safari 没有实现它:http://caniuse.com/#feat=input-minlength
您可能想尝试使用模式属性或此问题的其他答案之一:Is there a minlength validation attribute in HTML5?
关于javascript - Safari 中的 ReactDom 中缺少 "minLength",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37948334/