jQuery example

jQuery example for COMP1021

by scsswil

HTML

<div>
  <p>
    Hello world
  </p>

</div>
<button id="hide">Hide</button>
<button id="show">Show</button>

JavaScript

$(document).ready(function() {
  $("#hide").click(function() {
    $("div").hide();
  });

  $("#show").click(function() {
    $("div").show();
  });
});