javascript - Passing eventOption as argument to function -
module calls function other module registering , de-registering events on elements. i'm passing eventtype argument. getting error uncaught typeerror: elementobject.element.eventoption not function
elementobject = { element: document.getelementbyid("elemid"),... } eventregisterer(elementobject, addeventlistener)
function event registration:
function eventregisterer(elementobject, eventoption){ elementobject.element.eventoption('change', changefunction) } function changefunction() { .... }
why storing addeventlistener
argument not working?
found solution:
function eventregisterer(elementobject, eventoption){ elementobject.element[eventoption('change', changefunction)]; }
using array-like notation instead of directly using property name did work.
Comments
Post a Comment