jQuery change Events


change


The change event is triggered when the form field status changes: for instance, when someone clicks a radio button, or makes a selection from a dropdown menu or enter some text in an imput box. You can use this event to immediately check the selection made in a menu, or which radio button was selected.

Let us learn with a simple example.


<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="jquery-1.8.0.min.js"></script>
<script>
$(document).ready(function(){
  $("input").change(function(){
    $("span").text("Form Field change event fired"); 
  });
});
</script>
</head>
<body>

<input type="text">
<br />
<input type="radio">
<br /><br />
<span>Write some text in the input field, and then press enter or click outside the field</span> 
<br />
<p>Or click the radio button</p>
</body>
</html>



The change event works only with form.
You may like to try this example here.