Alex Alex - 1 year ago 99
Javascript Question

addEventListener Two Functions

I was wondering if addEventListener could have two functions inside it.
I have tried it but it seems not to work.
Please give me a simple example if it is possible.



Answer Source

Wrap your functions in a function.

function invokeMe() { console.log('I live here outside the scope'); }

function alsoInvokeMe() { console.log('I also live outside the scope'); }

element.addEventListener('event', function() {


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download