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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:04:17+00:00 2026-06-07T19:04:17+00:00

I have the following two tables. I’d like colgroups for each to highlite with

  • 0

I have the following two tables. I’d like colgroups for each to highlite with a mouseover, using jquery.

<div id="one">
    <table border=1>
        <colgroup><colgroup><colgroup><colgroup>
            <thead>
                <tr>
                        <th>A</th>
                        <th>B</td>
                        <th>C</th>
                        <th>D</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                        <td>1</td>
                        <td>2</td>
                        <td>3</td>
                        <td>4</td>
                </tr>
            </tbody>
    </table>
</div>
<div id="two">
    <table border=1>
        <colgroup><colgroup><colgroup><colgroup><colgroup><colgroup>                        
            <thead>
                <tr>
                         <th>A</th>
                         <th>B</th>
                         <th>C</th>
                         <th>D</th>
                         <th>E</th>
                         <th>F</th>
                </tr>
            </thead>
                <tbdoy>
                <tr>
                         <td>1</td>
                         <td>2</td>
                         <td>3</td>
                         <td>4</td>
                         <td>5</td>
                         <td>6</td>
                </tr>
           </tbody>
       </table>
</div>

Here is the Jquery:

$("table").delegate('td, th','mouseover mouseleave', function(e) {
              if (e.type == 'mouseover') {
                $("colgroup").eq($(this).index()).addClass("hover");
              }
              else {
                $("colgroup").eq($(this).index()).removeClass("hover");
              }
          });    

The jquery works for the first table, but when I go to the first col of the second table, the FIRST col from the FIRST table highlights. Columns 1-4 of Table 2 all highlight column 1-4 of table 1. When I do the FIFTH column in the second table, the FIRST column in the SECOND table highlights. And the sixth column makes the second column highlight.

Why is everything offset like that?

  • 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-06-07T19:04:19+00:00Added an answer on June 7, 2026 at 7:04 pm

    I think the below code will fix your issue, but it’s bee a long day, so it might not be perfect 🙂 The main thing is you need to reduce your colgroup collection down to just the current table being moused over.

    $("table").delegate('td, th','mouseover mouseleave', function(e) {
              var $table = $(this).closest("table");
              if (e.type == 'mouseover') {
                $table.children("colgroup").eq($(this).index()).addClass("hover");
              }
              else {
                $table.children("colgroup").eq($(this).index()).removeClass("hover");
              }
          });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following two tables Table: items ID | TITLE 249 | One
I have the following two tables and jQuery: <table class=grid /> <table class=grid custom
I have the following two tables in my mysql database. Table Name: groups id
I have the following two tables, affiliates and referrers. affiliates Table id loginid 3
I am using VB.NET with LINQ to MS SQL. I have two following tables.
Let's say you have the following two tables: X Table X_ID Y_ID_F X_Value 1
I have the following two mySQL tables with the 'child' table having a DELETE
I have the following two sql tables: The GlassesID Column in Glasses table is
I have two tables in my database. The first one, [nodeActivity] has the following
Suppose I have the following two tables in my MySQL database: Table 1:: EMP:

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.