How to run the code on change event using jQuery ? Last Updated : 15 May, 2023 Comments Improve Suggest changes Like Article Like Report In this article, we will see how to run the code on change events using jQuery. The change event is used to trigger when the user changes the value of the element. Syntax: $(selector).change(function) Example: In the below example, we are creating a textarea element that contains GeeksforGeeks text. When the user changes the textarea content and removes the cursor from the textarea, the change event is triggered and the styles are added to the textarea element. HTML <!DOCTYPE html> <html> <head> <title> How to run the code on change event using jQuery? </title> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"> </script> <script> $(document).ready(function() { $("textarea").change(function() { $("textarea").css({ background: "green", color: "white" }); }); }); </script> </head> <body> <center> <h1 style="color: green;"> GeeksforGeeks </h1> <h3> How to run the code on change event using jQuery? </h3> <textarea rows="5" cols="30">GeeksforGeeks </textarea> </center> </body> </html> Output: Comment More infoAdvertise with us Next Article How to run the code on change event using jQuery ? V vkash8574 Follow Improve Article Tags : Web Technologies HTML JQuery jQuery-Methods HTML-Questions jQuery-Questions +2 More Similar Reads How to run a code on click event in jQuery ? In this article, we will see how to run the code after clicking on an event. To run the code after clicking an event, we use the click() method. The click() method is used to run the code when a click event occurs. The click() method to attach a click event handler to selected elements. Inside the h 1 min read How to detect and change the content/style of a div using jQuery ? The changes to the html/text of a div can be detected using jQuery on() method. The on() is used to attach one or more event handlers for the selected elements and child elements in the DOM tree. The on() method is the replacement of the bind(), live() and delegate() method from the jQuery version 1 2 min read How to run a code on hover event in jQuery ? In this article, we will see how to change the style of elements on hover event using jQuery. To change the style of hover event, hover() method is used. The hover() method is used to specify two functions to start when the mouse pointer moves over the selected element. Syntax: $(selector).hover(Fun 1 min read How to run a code on mouseenter event in jQuery ? In this article, we will see how to run the code when the mouse enters into the specific area using jQuery. To run the code on a mouse enter a specific area, mouseenter() method is used. The mouseenter() method works when the mouse pointer moves over the selected element. Syntax: $(selector).mouseen 1 min read How to fire an event on file select using jQuery ? Given an HTML document and the task to fire an event when a file is selected using jQuery. The JQuery change() method is used to fire an event when file is selected. Using change() method: It is used to change the value of the input fields. This method works with "input, textarea and select" element 2 min read Like