Share on Google+Share on Google+

jQuery change event

In this tutorial , we will discuss about 'change' event of jQuery.

jQuery change event

In this tutorial , we will discuss about 'change' event of jQuery. In given below example ,the change event is fired when there is change in the element (on which event is set).When the second option is selected from the dropdown, the alert is displayed. It is also displayed if we change the text in the field and then click away.


<!DOCTYPE html>
<script src="jquery-1.4.2.js"></script>
<input class="flag" type="text" value="Input Field" />
<select class="flag">
<option value="option1" selected="selected">First Option</option>
<option value="option2">Second Option</option>
<div id="other">
Select second option or edit first input field to trigger the alert box.
$('.flag').change(function() {
alert('Change method is trigerred');


When we edit input field :

When we select second option :

Download Source Code

Click here to see demo


Posted on: July 29, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.


Advertisement null