jQuery bind event

jQuery bind event example for COMP1021

by scsswil

HTML

<p>When the text is click on it will turn green.</p>
<p id="example">Click on me</p>

JavaScript

$(document).ready(function() {
  $("p").bind("click", function() {
    $(this).css('color', 'green');
  });
});