JQuery documentation has this to say about .load(fn) (http://docs.jquery.com/Events/load#fn ):
Note: load will work only if you set it before the element has completely loaded, if you set it after that nothing will happen.
So when one is supposed to bind the load event for <div id="test">
? As far as I understand doing it before this div actually appears won't work, because $('#test') won't select it, and doing it after that is, as mentioned above, too late. Following code seems to support this:
<html>
<head></head>
<body>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
$('#test').load(function(event) { event.target.css('color', 'blue'); alert('a');});
</script>
<div id="test">TEST</div>
<script type="text/javascript">
$('#test').load(function(event) { event.target.css('color', 'red'); alert('b');});
</script>
</body>
</html>
After loading it nothing happens (no color changes, no alerts) and Firebug says everything is ok.