KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a input tag with an onblur event listener: <input id="myField" type="input" onblur="doSomething(this)" /> Via JavaScript, I want to trigger the blur event on this input so that it, in turn, calls the doSomething function. My initial thought is to call blur: document.getElementById('myField').blur() But that doesn't work (though no error). This does: document.getElementById('myField').onblur() Why is that? .click() will call the click event attached to an element via the onclick listener. Why does blur() not work the same way?
Tags (comma-separated)
Save Edits
Cancel