Jquery load() help

Posted by mtwallet on Stack Overflow See other posts from Stack Overflow or by mtwallet
Published on 2010-04-01T12:06:36Z Indexed on 2010/04/01 12:13 UTC
Read the original article Hit count: 312

Filed under:
|

Hi. I am creating a portfolio page for m personal site. I have a slider with approx 20 anchors that link to projects I have worked on, each one contains a client logo that when clicked should load some html content then fade that content into a container div on the same page.

I have been advised to use the JQuery method load() which seems straight forward. The question I have is do I have to repeat the following code for each of the 20 anchors as the url is different for each one or is there a more efficient way?

$('a#project1').click(function() {
   $('#work').load('ajax/project1.html');
}

Also would I have to use the unload() method first to ensure the div I am loading into is empty? Many thanks in advance.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about load