function listeners(){
validation = new Validator();
for(input in inputs){
el = $("#"+input+"");
addEvent(el, "input", function(){
inputs[input].value = el.value;
if(validation.fails(inputs[input])){
//Do something
}
})
}
}
Hi guys, i have three inputs {name, email, comment}
, and i want to attach an event listener and make some validation to every input. The above code works but it returns always the last input(comment). Please, is there any solution to solve this problem? I thought about callback, but i didn't know how to implement it in this context.