Skip to content
Advertisement

What’s wrong with addlistener… how do I fire my event

I am using the following functions to do my task. It works fine when cursor moves away from the textbox but if I want to fire the same event from code say like next function I get an error…

JavaScript

Advertisement

Answer

Adapting the code given as a jQuery extension in this answer, here’s a function you can use to programmatically fire an event cross-browser:

JavaScript

Your fire function would then look like this:

JavaScript
Advertisement