Javascript object not recognized as DOM object for addEventListener -


I am trying to wrap my head about why I am not working on this code. I read on the dom and add the event listeners, and I understand that an event listener can only be added to an object of the DOM. Technically, the returned value of _get_elem should be a DOM object and still still does not work. If anyone knows why it does not work or indicates me in the direction of a resource, how to do it, it will be highly appreciated.

  window.onload = funtion () {// works.logElementByID ('element_id') AddEventListener ('Click', _fn (), Incorrect); Var exfnvar = new exfn (); // exfnvar.exel.addEventListener ('click', _fn (), wrong) does not work; // also exfnvar._get_elem () does not work. AddEventListener ('click', _fn (), false); }; Var exfn = function () {this.exel = document.getElementByID ('element_id'); This._get_elem = function () {return Document.getElementByID ('element_id'); }}; Function_fay () {// do something};  

You are calling function and return audio as callback to event listener Are giving up. Instead, you have to give the callback to the function.

Change

document.getElementByID ('element_id'). AddEventListener ('click', _fn (), incorrect);

to

  document.getElementByID ('element_id'). AddEventListener ('click', _fn, false);  

Also with other lists ..


Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -