I'd like to attach an event when a function is called, but it seems not working using addEventListener...
My code :
function add () {
this.inputString.input.addEventListener('mouseover', toggle.call(this));
}
function toggle () {
$(this.tooltip).toggle();
}
Issue : the toggle() function doesn't work. However, this.inputString.input and this.tooltip are not emtpy...
thisusebindinstead ofcallbindinstead ofcall?callwould "call" (i.e. invoke) the function immediately,bindwould return a "bound function", which could be used as a handler.