on page 135 there is the following excerpt from tooltips.js:
why is showTip using "this" but preventDefault using "event" ?
why is hideTip using "this" when "event" is the parameter?
i know it's right under my nose but i'm not quite getting it
this refers to the element on the page which triggered the event, so in this case an anchor element.
event is a MouseEvent, who's default action needs preventing.
this is available within the scope of the function, without having to pass it explicitly as a parameter.
You could also write:
and leave out the event entirely.
ah, thanks, getting clearer, will re-read this section but much better
this is available within the scope of the function
i remember reading about 'this' and scope within and outside of a function, will re-read this section of the book
This topic is now closed. New replies are no longer allowed.