Not apply invalid first before valid? (textarea valid after .replace)

https://jsfiddle.net/gdkr2pb3/

So is display green by default why?

Any idea?

Thanks!

The empty input isn’t invalid unless you use the required attribute in it.

1 Like

Thanks for your help!
From this got an another problem. Like I have 15 char required to be valid in textarea. And have a word to detect to replace but that is not that long like min char required and that is make valid after .replace?

Any idea why? or what can to do? Word is from this to tothis

test

https://jsfiddle.net/nb7qzja2/2/

So how can prevent to be valid textarea after .replace? as is not contain 15 char minimum?

Thanks!

I think changing the value like that will mess with the build-in validation. You can check the validity states on the element console.log(e.target.validity) (more info ValidityState). You might have to do some custom validation.

Can I ask why you are changing the users input? That doesn’t seem like something you would expect as a user to have happen.

1 Like

You know just try out all things as possible. I got it. Yes for sure is break something there so is not so useful to use :smiley:. Thank you!