Detecting Div content change
Detecting when the contents of a div changes using .change
by andysmiffy
HTML
<select id="options" name="options">
<option name="val1" value="None" >Please select</option>
<option name="val2" value="John" >John</option>
<option name="val3" value="Paul" >Paul</option>
<option name="val4" value="George" >George</option>
<option name="val5" value="Ringo" >Ringo</option>
</select>
<div id="test">No favourite Beetle chosen</div>
<div id="changed">Div not changed</div>
JavaScript
$('#options').change(function () {
$('#test').text("My favourite Beetle is : " + $(this).val() );
});
$('#test').change(function () {
$('#changed').text("the div changed: " + $(this).val());
});