So, I have a form, but I donβt need to send information to the server yet ... I just need to run the fields through the built-in HTML5 validation conditions (for example, by email, etc.), and if true, just follow certain function ...
So far I have come up with this ...
function checkform() { var if (inputElement.validity.valid == 'false') { } else { navigateNextStep(); } }
That logic I came up with so far, and a little back, because I imagine, it is SIGNIFICANT that there is an invalid value, therefore, triggering validation hints ...
My only problem with the above logic is that I have about 7-8 input elements, and I find an option to do the following rather than the "dirty" one:
var inputs = document.getElementsByTagName("INPUT"); if (!inputs[0].validity.valid && !inputs[1].validity.valid && ...)
Ideas?
source share