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 6785775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:10:04+00:00 2026-05-26T17:10:04+00:00

I have a page with multiple divs, these are used to make tabs with

  • 0

I have a page with multiple divs, these are used to make tabs with jquery.

I am loading in external pages with php like mysql data with pagination etc.

what i want is when a user clicks a link in each div it replaces the div with content from that url.

e.g.

<div id="home">
<a href="home1.php">Home1</a>
<a href="home2.php">Home2</a>
</div>

<div id="music">
<a href="track.php?tid=1">Track 1</a> - <a href="artist.php?aid=3">Artist</a>
<a href="music.php">First</a> <a href="music.php?page=1">Page 1</a> <a href="music.php?page=2">Page 2</a> 
</div>

so when i click home1 it replaces the home div with home1.php
when i click page 1 it replaces music div with music page 1 etc.

How do i do this? i have been looking at jquery click() and replacewith() but have not yet worked out how to do it.

Thanks.

  • 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-26T17:10:04+00:00Added an answer on May 26, 2026 at 5:10 pm

    Attach an event to the links you want this feature active on – you can do that by either adding a class to the links – ie

    <div id="home">
    <a class="livelink" href="home1.php">Home1</a>
    <a class="livelink" href="home2.php">Home2</a>
    </div>
    
    <div id="music">
    <a class="livelink" href="track.php?tid=1">Track 1</a> - <a class="livelink" href="artist.php?aid=3">Artist</a>
    <a class="livelink" href="music.php">First</a> <a class="livelink" href="music.php?page=1">Page 1</a> <a class='"livelink" href="music.php?page=2">Page 2</a> 
    </div>
    

    And then binding the click event to all those anchors :

    $('.livelink').click(function(event) {
      $(this).parent('div').load($(this).attr('href')); //load the data
      event.preventDefault(); // prevent the browser from following the link
    });
    

    or by activating all links

    $('div a').click(function(event) {
      $(this).parent('div').load($(this).attr('href'));
      event.preventDefault; // prevent the browser from following the link
    });
    

    I think you are better using the first method as you have more control

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page with multiple divs in it. I like to update the
I have a search page that is used in multiple places with multiple 'themes'
I have multiple divs in my page as: <div imageId='image5' name='5' class='speechBubble'> <div imageId='image5'
I have a page that has multiple sliders (from http://www.switchonthecode.com/tutorials/using-jquery-slider-to-scroll-a-div ) and since each
Okay, I have a page on a Drupal install that has multiple divs. I
I have a page with multiple divs that hold different sections of content. Initially,
We have an HTML page with multiple div blocks. We want to separate these
i have multiple divs with the same class on my page. I want to
I have a page with multiple forms that I submit via Ajax POSTs serially.
I have an aspx page with multiple FileUpload controls and one Upload button. In

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.