This Website has been Deprecated. Use
For Prework and Written Curriculum

JavaScript Events

What is an event?

  1. Something the browser does.
  2. Something the user does.

Visit W3 Schools for a more complete list.


On Click

Specifies a JavaScript action when a user clicks on an element.

Click Me

<div id="click"
onclick="document.getElementById('click').innerHTML = 'Thank you.';">
Click Me

On Mouse Over and On Mouse Out

Hover over me.

<div id="mouse"
onmouseover="document.getElementById('mouse').style.backgroundColor = 'red';"
onmouseout="document.getElementById('mouse').style.backgroundColor = 'blue';">
Hover over me.