Takahiro Ikeuchi
Takahiro Ikeuchi

Reputation: 79

Missing "minLength" in ReactDom in Safari

React JSX:

<input
    type="password"
    name="password"
    value={this.state.password}
    minLength={2}
    maxLength={4}
    required="required"
    onChange={e => this.handleOnChange(e)}
    placeholder="Password"/>

handler:

handleOnChange = (e) => {
    console.dir(e.target)
    console.dir(e.target.minLength) // ==> expected value is 2, but undefined
    console.dir(e.target.maxLength) // ==> 4

In Chrome, I'm able to find the "minLength". But in Safari, missing key-value paris of "minLength".

"maxLength" does exist.

I don't have a grip of this problem, Does Safari not implement "minLength"?

Version:

Upvotes: 0

Views: 4060

Answers (1)

Radio-
Radio-

Reputation: 3171

Nope, Safari doesn't implement it: http://caniuse.com/#feat=input-minlength

You might want to try using the pattern attribute or one of the other answer to this question: Is there a minlength validation attribute in HTML5?

Upvotes: 1

Related Questions