Article Image
read

If you don't know, jQuery can load a remote page into a DIV very easily. Not only that, it can also filter on which parts of that page get loaded.

First you have to use load method of the target div. For example if my div looks like <div id="target">, then my load call will look like $("div#target").load(  "file.html" );

The load method has more to offer than that though!

You can only load into your target div the sections of interest my specifying selectors after the url.

Ex.  $("div#target").load("file.html .targetClass"); will loading all of the elements in file.html with the class "targetClass".

To see this in action, see the live example here. The file being loaded is here.

Blog Logo

Jon Dowdle

Jon Dowdle currently works on the internet at a lovely place called InVision.


Published

Color

Jon Dowdle's Blog

The personal blog of Jon Dowdle.

Back to Overview