100yen 2 Posted April 15, 2014 Report Share Posted April 15, 2014 Hi, I am reading this book at second time. At advance Event Handling section, I am confusing about the statement that describes 'return false' vs 'e.preventDefault()'. At page 290, Larry writes 'On any browser that supports the addEventListener() method, event handlers will automatically receive a single argument, which represents the event that occurred. I think the single argument is event object, right? At page 298, 'For browsers that don't support the addEventListener() method, an alternative way of preventing the default event behavior is to invoke the preventDefaut() method of the event object. My question is that since the browser don't support addEventListener() method, there should be no event object received as argument. Then how come the alternative way of using event.preventDefault( )? Quote Link to post Share on other sites
HartleySan 826 Posted April 16, 2014 Report Share Posted April 16, 2014 Yes, you're right. There is a mistake on page 298, which is noted in the errata on the following page: http://www.larryullman.com/books/modern-javascript-develop-and-design/errata/ Quote Link to post Share on other sites
100yen 2 Posted April 16, 2014 Author Report Share Posted April 16, 2014 thanks HartleySan Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.