Topic 9: JavaScript Events

With HTML and JavaScript, you can make certain events happen to an element. JavaScript will access the needed HTML element and will tell the browser to do something when an event happens. Some of these events include onclick, onload, onmouseover, etc. JavaScript events make the page more interactive and can even help cue the user in on tasks that they might need to do.

The following examples are just a few of the events that can be used. Here is a reference to a longer list of events from W3Schools.

To view each example, simply click on the "Result" button.

onclick

onload

onmouseover and onmouseout

Resources



You can also use JavaScript to perform mobile events. These events are called touch events and are triggered based on when or where the user touches their screen. They work on elements that are on mobile phones and tablets (touch sensitive devices). These are some of the events:

list of touch events

Resources



This is my teaching video. It begins at 0:00 and ends at 5:25.