3 ms·
Modern CSS and HTML's built in elements are better at a lot of the things people use JS for. I think as coders we feel most comfortable reaching for JavaScript
by _2z1p 3y ago
Modern CSS and HTML's built in elements are better at a lot of the things people use JS for.
I think as coders we feel most comfortable reaching for JavaScript first, when really we should be doing as much in HTML itself as possible, then prettying it all up with CSS, and then finally adding some JS for interactivity such as client side form validation.
- twiss 3y agoIndeed, and even a lot of client side form validation can be done using HTML and CSS: https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_va...
- lelandfe 3y agoIt’s pretty limited, though, and has some random quirks. Like a required field will be marked as invalid immediately on load, or that it’s not really possible to display multiple errors on a single input. You can work around them, but you’re approaching the complexity of just writing your own validator by that point.