What exactly are you trying to do? If you're trying to load HTML into a div, you can kind of imitate it with a setInterval function that periodically checks whether the content has changed or not. If the div is not empty, first you check the content and store it (or a checksum of it) somewhere. Then run a setInterval to check whether the content (or its checksum) has changed every so often. If so, run a callback function. (This wouldn't work on checking whether an image is loaded, only HTML content. You'd have to directly check the <img> fire the load callback for that.)
You can bundle this all into a custom jQuery event. Who knows, there's probably a plug-in or something out there for it already... On Oct 1, 5:30 pm, Michael Rowe <flyagari...@gmail.com> wrote: > Ok, so is there a way with javascript to fire a function when a div is > finished loading it's contents? > > On Thu, Oct 1, 2009 at 8:38 PM, MorningZ <morni...@gmail.com> wrote: > > > James: there is also a JavaScript event called "load" for certain DOM > > objects.. and consequently the ability to wire jQuery onto that > > (http://docs.jquery.com/Events/load#fn) > > > to original poster: > > > "if I target the IMG, then it works fine, but how come it doesn't work > > with the div? " > > > because <div>'s don't fire a "load" event, and as you found out, > > images do > > > On Oct 1, 5:31 pm, James <james.gp....@gmail.com> wrote: > > > load() is suppose to take a url as the first parameter. > >http://docs.jquery.com/Ajax/load > > > > On Oct 1, 8:47 am, flyagaricus <flyagari...@gmail.com> wrote: > > > > > I'm new to JQuery > > > > > I can't get load() to work with a div class: > > > > > <script type='text/javascript'> > > > > jQuery(document).ready(function($) { > > > > $(".Loader").load(function(){ > > > > alert("bang"); > > > > }); > > > > }); > > > > </script> > > > > <div class="Loader"> > > > > <img src="http://home.arcor.de/poesenau/Witness-Tree.JPG" > > > > width="1200" height="1600" /> > > > > </div> > > > > > if I target the IMG, then it works fine, but how come it doesn't work > > > > with the div? > >