Detecting Input Change in jQuery

In this tutorial, we'll see how to detect any input change in the input text box using jQuery?
Submitted by Pratishtha Saxena, on July 22, 2022

Detecting Input Change using jQuery .change() Method

This is a jQuery inbuilt method. It gets triggered as soon as any input text is changed in the specified input box in a webpage. This detects any changes in the input box. As this method is triggered, it also initiates the function attached to it (if any). The function here is optional.


$(selector).change( function());

This method of jQuery can be implemented for other elements also apart from only input box. It can be used to detect changes in the textarea tag also.

Let's understand this better with an example.

Here, we take an empty input filed and apply change method to it. As soon as we write anything in that field, the change method detects the changes there and triggers the function attached to it.



<!DOCTYPE html>
<html lang="en">
      <meta charset="UTF-8">
      <script src=""></script>
         <h2>Detecting Input Change</h2>
         <p>Write some text in the below given input box and then press enter. Check console window as soon as the enter key is pressed.</p>
         <label>Enter Text:</label>
         <input type="text" id="input">


      $("#input").change( function() {
        console.log('Input value has been changed!');


Example: Detecting Input Change

All jQuery Examples

Comments and Discussions!

Load comments ↻

Copyright © 2024 All rights reserved.