Question: I'm having problems trying to validate form data from my html file using javascript. For the javascript functions: I want to validate that when a
I'm having problems trying to validate form data from my html file using javascript.
For the javascript functions:
I want to validate that when a checkbox has been checked then a value needs to be entered in the number box corresponding to the checkbox. For example, if the user selects "Cereal" with the checkbox option, I want the javascript program to display an alert as "Please enter a quantity for the selected item" only if they have selected the item but they have not entered a quantity. If the user does not select an item to begin with then the javascript function should not apply.
Also, an alert should pop up if the user tries to enter a quantity value more than 5. Ex. "You cannot enter a value greater than 5."
I also want to validate if the user selects a payment option via radio buttons. For example, if the user does not select a payment option then an alert will pop up prompting the user to select a payment option.
Here is what I have so far on my HTML file:
Grocery Item Selection
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
