A client has a contact form that is submitted using an AJAX callback. After completing the AJAX request, the form fields are cleared.
This is where the problem manifests: the emptied form fields are instantly marked as errorous by the browser.
Is there a way to remove the validation error using JavaScript?
Don't clear individual values, just use the reset() function on the form element. This clears the form to its original (empty) state and no errors appear.
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