Reputation: 2585
I try to attach an event on a input element, then I put this code on onload
of body element:
bornDate.attachEvent("onblur", validade(true));
But in onload, the function validade
executes! I want the function executes only on onblur
of bornDate
element.
Upvotes: 0
Views: 41
Reputation:
To keep validade from executing, you have to embed the function call inside a function. The function reference gets passed to attachEvent.
bornDate.attachEvent("onblur", function () {
validade(true);
});
Upvotes: 1