ngreenwood6
ngreenwood6

Reputation: 8216

jquery multiple load

Is it possible to load multiple items at once through jquery using $.load? For exmaple I may have something like this:

<div id="test">

  <div id="what">
  </div>

  <div id="when">
  </div>

  <div id="who">
  </div>

</div>

Now say I wanted to load the div with the id of what and the id of when but not the who. is this possible?

Upvotes: 0

Views: 1744

Answers (1)

Doug Neiner
Doug Neiner

Reputation: 66191

If you wanted to load just those two divs into the same container, you would use this:

$("selector").load("/url #what, #when");

You can add any selector after the URL as long as there is a space between the selector and the url.

So with this HTML:

<div id="container"></div>

And this jQuery:

$("#container").load("/url #what, #when");

You would get:

<div id="container">
   <div id="what"> ... </div>
   <div id="when"> ... </div>
</div>

Upvotes: 2

Related Questions