Andrey
Andrey

Reputation: 2585

How to attach an event in IE?

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

Answers (1)

user2625787
user2625787

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

Related Questions