---
title: "jQuery .ready event on dynamic content"  
description: "jQuery .ready event on dynamic content"  
author: "Kate Smith"  
published: 2013-10-14  
updated: 2013-10-14  
canonical: https://www.mindstick.com/forum/1661/jquery-ready-event-on-dynamic-content  
category: "jquery"  
tags: ["jquery"]  
reading_time: 1 minute  

---

# jQuery .ready event on dynamic content

I have a [dynamic](https://www.mindstick.com/blog/11080/features-of-java-dynamic-complied-and-interpreted) list loaded into an HTML 5 [web app](https://www.mindstick.com/blog/74221/tips-on-real-estate-web-app-development) built using jquery [mobile](https://www.mindstick.com/articles/310668/reasons-why-you-should-choose-custom-mobile-app-development-for-your-business) + (jquery and [javascript](https://www.mindstick.com/articles/874/how-to-create-watermark-text-for-textbox-by-using-javascript)).

I want to display a simple "loading..." image by placing a <div> on the page while the list is populated dynamically. Once the list is complete I need a event to fire to [remove](https://yourviews.mindstick.com/story/4554/8-harmful-weeds-to-remove-from-garden) the "loading..." image. Is it possible to attach the .ready or .load events to a element of the dynamic list so I get a event to fire when the list has loaded?

Thanks for any [advice](https://yourviews.mindstick.com/view/50528/filament-advice-5-things-to-consider-before-you-buy-a-filament), searching for existing [answers](https://www.mindstick.com/forum/156899/salesforce-marketing-cloud-interview-questions-answers) on the .ready [subject](https://yourviews.mindstick.com/view/259/physical-education-a-compulsory-subject-in-school-curriculum) only provides [results](https://yourviews.mindstick.com/story/4497/usage-of-baking-soda-magical-results) about [document.ready](https://www.mindstick.com/forum/481/difference-between-onload-and-document-ready) use of the event.

## Replies

### Reply by Hank Greenberg

Use the callback function.

\

```
$(function() {
    $('#content').html('<div>loading...</div>');
    $('#content').load('http://mynewcontent.com/', function(data) {
        // optional: do more stuff here.. not needed since the content will already be replaced.
    });
});
```


---

Original Source: https://www.mindstick.com/forum/1661/jquery-ready-event-on-dynamic-content

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
