I have a form with 2 required fields (first name and last name).
When I click the submit button without the fields being completed, a red border appears around
the input boxes. How do I use css to change that color from red to purple?
javascript. when the specific element loses focus or, if you prefer , when the form is submitted, the .js validates the value of the field. if the value fails validation, then an error class is added. if it fails, the class is removed ( if it want there to begin with it doesn’t matter) . This is probably useful because the .js can prevent the form from submitting as well and thus keep valid info from being sent to the DB.
Note, without submitting the form and for modern browsers, and assuming you are only implementing basic type validation, you could use :invalid {...your style...}