jQuery mouse event example

jQuery mouse event example for COMP1021

by scsswil

HTML

<p>Move the mouse over this paragraph.</p>

JavaScript

$(document).ready(function() {
  $("p").mouseover(function() {
    $("p").css("background-color", "#ee1212");
  });
  $("p").mouseout(function() {
    $("p").css("background-color", "#1212ee");
  });
});