I have 11 inputs on a page, some are text inputs, some drop downs. I would like to validate each one to make sure that it is not blank on the click of a submit button I have at the bottom, and have an appropriate message display specific to each that says “This field is blank”, “this field” being the name of each field depending upon whether it is blank. I’m just wondering if there is a simple way to do it without creating a form and using if statements for each of the 11 fields.
Share
If you are just checking that they’re all not empty, the easiest way is to use some sort of loop that goes through each input. If it finds one empty, activate some sort of error message next to it, so that all fields immediately show an error.