I am attempting to do a mock form with validation.
I could get a validation plugin I know but I would rather just add and remove classes on a button click if possible. See pen:
And your question is? It works fine; it adds the class if the name field is empty and removes it if non-empty.
I needed to add e.preventDefault();
for it to work properly. Not sure why.
1 Like
Iām pretty happy with it now.