The change() event is used to check if the contents of an element has changed or not.
<html>
<head>
<title> My First Programme </title>
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"> </script>
</head>
<body>
<h1> JQuery </h1>
Type Something then click outside : <input type = "text">
<script>
$('input').change( function() {
$(this).css("background-color", "yellow")
});
</script>
</body>
</html>
So, in the above code, we have an <input> element of type text.
<input type = "text">
And whenever we type something, and move the cursor outside the <input> element, the contents of the <input> element is changed and change() event is triggered.
$('input').change( function() {
$(this).css("background-color", "yellow")
});Changing the background color of the <input> element to yellow.