Cross-browser function for adding an event listener
Here is a function that should work in virtually every browser, even really old ones. Of course, it is only useful, if you don’t use jQuery. Because, if you do, a far better way is to just call .on()
or .bind()
or .delegate()
or .live()
or whatever you want, and let jQuery do all the dirty work.
Read More “Cross-browser function for adding an event listener”