events - Why doesnot removeEventListener work?? -
var mouselistener = button2.addeventlistener("mouseover", function (e) { count++; ... if(count > 5) button2.removeeventlistener("mouseover", mouselistener); });
i don't why code doesn't work??? how use removeeventlistener ()
in javascript?
the listener
function
passing in addeventlistener
function.
var mouselistener = function (e) { count++; ... if ( count > 5 ) { button2.removeeventlistener("mouseover", mouselistener); } } button2.addeventlistener("mouseover", mouselistener);
documentation:
https://developer.mozilla.org/en-us/docs/web/api/eventtarget/removeeventlistener
Comments
Post a Comment