Or just use vanilla JS
The DOM API does not spark joy.
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.
You can work around them, but you’re approaching the complexity of just writing your own validator by that point.