Get the latest tech news
Events
Events are things that happen in the system you are programming, which the system tells you about so your code can react to them. For example, if the user clicks a button on a webpage, you might want to react to that action by displaying an information box. In this article, we discuss some important concepts surrounding events, and look at the fundamentals of how they work in browsers.
You can find HTML attribute equivalents for many of the event handler properties; however, you shouldn't use these — they are considered bad practice. With JavaScript, you could easily add an event handler function to all the buttons on the page no matter how many there were, using something like this: Finally, many common server configurations will disallow inline JavaScript, as a security measure.
Or read this on Hacker News