Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 696021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:01:12+00:00 2026-05-14T03:01:12+00:00

I am trying to use load() to place some html into a div on

  • 0

I am trying to use load() to place some html into a div on a page. I have a bunch of links like this:

    <div id="slideshow">
        <div id="slides">
        <div class="projects">
            <a href="work/mobus.html" title="Mobus Fabrics Website">
                <img src="images/work/mobus.jpg" alt="Mobus Fabrics Website" width="280" height="100" />
            </a>

            <a href="work/eglin.html" title="Eglin Ltd Website">
                <img src="images/work/eglin.jpg" alt="Eglin Ltd Website" width="280" height="100" />
            </a>

            <a href="work/first-brands.html" title="First Brands Website">
                <img src="images/work/first-brands.jpg" alt="First Brands Website" width="280" height="100" />
            </a>
        </div>

        <a id="prev"></a>
        <a id="next"></a>
    </div>

and my jquery code looks like this:

$('.projects a').click(function() {
    $('#work').load(this.href);
});

The problem is when clicked the html is placed in the #work div the html is loaded in another page. Please can anyone help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T03:01:13+00:00Added an answer on May 14, 2026 at 3:01 am

    You need to prevent the default action to stop the href being loaded:

    $('.projects a').click(function(event) {
        $('#work').load(this.href);
    
        event.preventDefault();
    });
    

    You may also see people achieving the same by doing:

    $('.projects a').click(function(event) {
        $('#work').load(this.href);
    
        return false;
    });
    

    However, this method will stop the event bubbling any further, as well as preventing the default action. If you’ve got any delegate or live methods listening for the same event further up the DOM tree, doing return false will stop these handlers being called.

    Edit: For the callback function:

    $('.projects a').click(function(event) {
        $('#work').load(this.href, function (text) {
            alert("This loaded: " + text);
        });
    
        event.preventDefault();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok I have this problem I'm trying to use Jquery to load a partial
We have some html that looks like this: <form id=MyUserControl runat=server method=post> <script language=javascript
I'm trying to use slime from CVS (2009-01-05) but keep getting this error: LOAD:
I am trying to do a basic div layout and would like to use
I'm trying to put some ads on my site and would like to load
I'm trying to use the following code # LOAD XML FILE $XML = new
I have a Set object and I use this set to ensure that when
I've got some banner zones set up on advertisespace.com - I'm trying to load
I am trying to place an action to happen after an entire .aspx page
I'm trying to load an elf file into a MIPS simulator I made. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.