edit: change the .ready () prompt to Matt's suggestion.
I use jQuery to configure some of these things:
$(function ()
{
$('.myThing').each(function() {
... configure it ...
});
});
My problem is that a new element is added to the DOM after calling .ready (). No configuration is performed for these items.
For simple things, such as binding a click event, .live () does the job. But for more complex things, I did not find a good solution.
Is there an event when the DOM changes? Or, in particular, when new elements are added to the DOM?
Edited: A preliminary solution using livequery is as follows:
$(function ()
{
$.fn.configureIt = function()
{
... configure it ...
}
});
$('.myThing').livequery(function () {
$(this).configureIt ()
});
: livequery . DOM . , , . , , livequeries IE6, .
, " " . JavaScript , JavaScript, JavaScript, HTML . JavaScript .
, , , , DOM AJAX , :
$('.stuff').load(loadUrl, postData, function() {
$(this).trigger('contentLoaded');
});
.
$('*').live('contentLoaded', function() {
$('.myThing', this).configureIt();
});
. , - ( , ), , , , .