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

  • SEARCH
  • Home
  • 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 5976355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:12:59+00:00 2026-05-22T21:12:59+00:00

I used the following jquery to load an external html page into a div

  • 0

I used the following jquery to load an external html page into a div named content:

$(document).ready(function(){
     $("#content").load("content.html");
});

(function($) {  
 $(function() {  
 $('.load_link').click(function() {  
    $("#content").load("content2.html");  
    return false;  
 });  
});  
})(jQuery); 

The link (using <a class="load_link">) that triggers the change of content is within a row in a table. I’d like to be able to update the class assigned to a row of a table when someone clicks a link. The row that contains the link clicked should be assigned the class “rowselected” and all other rows (in that table only) should be assigned the class “rownotselected”. Only rows in this table use those class names so it should be safe to replace any occurrence of that class name.

It this possible? I’m using jquery for the very first time.

Thanks in advance for any advice!

  • 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-22T21:12:59+00:00Added an answer on May 22, 2026 at 9:12 pm

    How about:

     $('.load_link').click(function() {  
        $("#content").load("content2.html");  
        var $row = $(this).closest("tr");
        // find the parent <tr> and set the class
        $row.removeClass("rownotselected").addClass("rowselected");
        // Set the class of the other rows:
        $row.siblings("tr").removeClass("rowselected").addClass("rownotselected");
        return false;  
     }); 
    
    • Find the parent tr using closest()
    • Use removeClass and addClass to remove the appropriate classes
    • Using siblings() to find sibling rows in the current table.

    Here’s a working example: http://jsfiddle.net/andrewwhitaker/vN2ny/

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

Sidebar

Related Questions

I need to load aspx page into jQuery UI's modal dialog window. I used
I see the following HTML code used a lot to load jQuery from a
I used the following function: function datediff() { var dat1 = document.getElementById('date1').value; alert(dat1);//i get
I used the following function I found online and it works perfectly. However, when
I used the following jQuery example which works like a charm. However it appends
I have following code on my site: backgroundImages[bg_img_path_b]=new Image(); backgroundImages[bg_img_path_b].src = bg_img_path_b; backgroundImages[bg_img_path_b].loaded=loading; //jQuery(backgroundImages[lastImage]).unbind('load.backgroundImages');
I used the code from the following question to insert a YouTube video into
I have HTML like the following on my website: <div class=groups> <div class=group> Group
I'm working on a site someone else developed. They used the following jQuery code
I'm using jQuery dialog to load a view, which is used to upload files

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.