Listen to changes within a DIV and act accordingly
Solution 1:
You can opt to create your own custom events so you'll still have a clear separation of logic.
Bind to a custom event:
$('#laneconfigdisplay').bind('contentchanged', function() {
// do something after the div content has changed
alert('woo');
});
In your function that updates the div:
// all logic for grabbing xml and updating the div here ..
// and then send a message/event that we have updated the div
$('#laneconfigdisplay').trigger('contentchanged'); // this will call the function above
Solution 2:
The change
event is limited to input
, textarea
& and select
.
See http://api.jquery.com/change/ for more information.
Solution 3:
http://api.jquery.com/change/
change does only work on input form elements.
you could just trigger a function after your XML / XSL transformation or make a listener:
var html = $('#laneconfigdisplay').html()
setInterval(function(){ if($('#laneconfigdisplay').html() != html){ alert('woo'); html = $('#laneconfigdisplay').html() } }, 10000) //checks your content box all 10 seconds and triggers alert when content has changed...