is-(in)valid doesn't seem to work at all
See original GitHub issue<form action="" class="was-validated">
<input type="text" class="form-control is-invalid">
</form>
:valid
seems to have higher priority over is-invalid
, hence the input is green. I have a piece of JavaScript which decides if the input is valid or not, and adds this class.
- Operating system and version: macOS High Sierra
- Browser and version: Google Chrome
- Reduced test cases and potential fixes: https://jsfiddle.net/fxxrqd13/
Related: https://stackoverflow.com/q/47427827/1420197 Related issue: #24743
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Spring portlet mvc: @Valid does not seem to work
I created a bean class and use it in my controller but it does not seem to work. Namely even though I enter...
Read more >Notarized app gets this message: r… | Apple Developer Forums
Notarized app gets this message: rejected (the code is valid but does not seem to be an app) ... I've successfully notarized my...
Read more >invalid - CSS: Cascading Style Sheets - MDN Web Docs
The :invalid CSS pseudo-class represents any , , or other element whose contents fail to validate.
Read more >Restrict data input by using validation rules - Microsoft Support
Field Validation Rule You can use a field validation rule to specify a criterion that all valid field values must meet. You should...
Read more >Page Indexing report - Search Console Help - Google Support
If your page or site is new, wait a few days for Google to find and crawl it. In an urgent situation, or...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@mdo I understand that, but how can we combine them?
My use case is that I use
.was-validated
on the form, and call thecheckValidation()
method, except one field has custom validation (I want to addis-(in)valid
classes there).The docs are pretty clear on this—
.was-validated
for is for live HTML5 validation in the browser while the classes.is-valid
and.is-invalid
are for custom validation you’d setup. In your latest fiddle, you were still using the class on the input when you should be using therequired
attribute.