I'm writing a form with javascript validation, I'd like to override the browser's built in spell checking.
For example, let's say I'm checking serial numbers and they all pass a regex text. I'd like to highlight the ones who don't in the browser much likes the browser highlights words with invalid spelling.
All I could come up with is disabling the browser's built in spell checking
So to sum it up
Is there a simple way to override a browser's built in spell check (sort of how like you override the comparator when you sort an array in javascript)
If there is not, is there a simple way to emulate such behavior?
Thanks a lot
The short answer; no, there is no Spellcheck API that JavaScript can hook into. Besides these kinda seem like different goals; a spellcheck is about natural language whereas you seem to really want input validation. You'd be better simply applying a different background / border colour or similar hint to the user via CSS when your JavaScript code detects an invalid serial (especially since each browser will render spellcheck errors differently anyway).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With