[jQuery] $(document).ready() does not work properly

[jQuery] $(document).ready() does not work properly


Hi all,
I discovered a few times now, that $(document).ready() does not work
properly.
The first time I recalled a function until the element was found:
if ($(this.INDICATOR_ID).size() == 0) {
var f = (function(o, i, d, c) {
return function() {
o.change(i, d, c);
};
})(this, arguments[0], arguments[1], arguments[2]);
try++;
if (try < 10) { // try max 10 times to find element...
setTimeout(f, 200);
}
} else {
//process as intended
}
You get the picture...
Next time it worked with a simple timeout:
setTimeout(doSomething, 1000);
But I found out that problems only occur if I include another script
element inside the body element, so if I include all scripts in the
head, everything is fine.
Does anyone know what's going on with onready? How reliable is it? Which
event is fired in which browser (DOMContentLoaded?)? I really don't.
Regards,
--Klaus
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/