Question: I have added the code to have city in it, but the form submits even without anything being entered into the City box. An error
I have added the code to have city in it, but the form submits even without anything being entered into the City box. An error message should come up if there isn't anything entered in the city box. The form should then submit when all three categories have something added into it Name, Age and City.
Add a text box for the users city to formvalidation.html
Ensure that the text box is not empty when the form is submitted by inserting additional code to the function validateForm() which is located in the head of the document.
If the text box is empty pop-up an appropriate alert message
Do not submit the form if the text box is empty
Here is the code with the city in it.
JavaScript Form Handling
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
