I have one function for validation,and a second function for message output how I can run both of them together with a single submit click.
var myform = document.forms.hform; // hform is name
myform.onsubmit = validation;
myform.onsubmit = exercise;
Just wrap them to one function:
myform.onsubmit = (e) => {
validation(e);
exercise(e);
}
You can call functions inside of functions…
function myFunc() {
validation();
exercise();
}
<button onsubmit=“myFunc”>
Modern javascript (by modern in this case I mean since about 2010 or even earlier) you'd use addEventListener
Like this
var myform = document.forms.hform;
myform.addEventListener('submit', validation);
myform.addEventListener('submit', exercise);
myform.addEventListener('submit', youSaidThreeFunctions);
You can add an event listener at any place in your code, so that's better than running the functions in another function
addEventListener is more flexible than using onEvent