jQuery .ready event on dynamic content

Total Post:24

 1515  View(s)
Rate this:

I have a dynamic list loaded into an HTML 5 web app built using jquery mobile + (jquery and 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 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, searching for existing answers on the .ready subject only provides results about document.ready use of the event.

  1. Post:12

    Re: jQuery .ready event on dynamic content

    Use the callback function.

    $(function() {
        $('#content').load('http://mynewcontent.com/', function(data) {
            // optional: do more stuff here.. not needed since the content will already be replaced.

      Modified On Apr-03-2018 04:38:36 AM