pretty much what title say, how i do this with Jquery?

Have you tried a conditional statement?

if (condition is true)
{
    // load div;
}

Jorge I always do it like this in php. But for example if i have a div that takes like 10 seconds to load and i write an if statement your saying that it will be faster if is false? or it will take 10 seconds anyways? .. dont know if u understand i speak mainly spanish.. Also how to do a spinner (or a "Loading...") and dont show the div until all div content is loaded
Thanks

Have you tried a conditional statement?

 if (condition is true)
> {
>     // load div;
> }

Ok so now you have explained what you actually are trying to do.

You can use the jQuery .load() method with a callback that hides the spinner once the div gets loaded.

 $(selector).load(url,data,callback);

Here is an example...

 $( "#div1" ).load( "ajax/test.html", function() {
       $("#spinner").hide();
  });

So I assume you have a button on the page to start some process. At that time, show the spinner and start the load process. With the example I gave you above, hide the spinner during the callback phase.

I'd recommend you take a look at this js spinner rather than using an animated gif. I use this in all my projects now.

http://fgnass.github.io/spin.js/

Que tenga un buen día

Thank you very much

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.