jQuery change event

jQuery change event example for COMP1021

by scsswil

HTML

<p>Write something in the input field, and then press enter or click outside the field. An alert will display if the text has changed.</p>
<input type="text">

JavaScript

$(document).ready(function() {
  $("input").change(function() {
    alert("The text has been changed.");
  });
});