How to pass dynamic variable inside function to another function inside it
i am trying to set dynamic clearing function and i am having issue with this code
var firstName = document.getElementById('firstName');
var lastName = document.getElementById('lastName');
var email = document.getElementById('Email');
function Clear(Vars) {
for (i = 0; i < Vars.length; i++) {
Vars[i].addEventListener("click", Clr, false);
Vars[i].addEventListener("oninput", Clr, false);
}
function Clr(){
Vars[i].setCustomValidity('');
Vars[i].style.removeProperty('border');
}
};
Clear([email, firstName, lastName]);
trying to find an easy way to pass "Vars[i]" to the second function.
i, notVars. Can't you just usethis?