How to perform text change event In jquery?

The change event occurs when the value of an element has been changed (only works on <input>, <textarea> and <select> elements).

The change() method triggers the change event, or attaches a function to run when a change event occurs.

Syntax:

$(selector).change()

Or

$(selector).change(function)

Ex:

<!DOCTYPE html>

<html>

<head>

<script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js”></script>

<script>

$(document).ready(function(){

  $(“input”).change(function(){

    alert(“The text has been changed.”);

  });

});

</script>

</head>

<body>

<input type=”text”>

<p>Write something in the input field, and then press enter or click outside the field.</p>

</body>

</html>