Skip to content
Justice Tech School

Click and Mouse Events

click, dblclick, mouseenter, mouseleave and hover react to the mouse. hover takes two functions, one for in and one for out.

Example
$('button').click(function () {
  alert('Clicked');
});
$('p').hover(
  function () { $(this).addClass('on'); },
  function () { $(this).removeClass('on'); }
);

Exercise

Mouse enters.

$('p').(fn)

Quiz Test

What does hover take?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.