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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:46:52+00:00 2026-05-21T06:46:52+00:00

Maybe this question is so easy… I understand html, css, the dom and javascript

  • 0

Maybe this question is so easy… I understand html, css, the dom and javascript pretty good, but I’m having a very tough time while trying to get jQuery to work for me. Let’s say I have the following 4 columns table, with columns 1 and 3 hidden:

<table id="mytable">
  <thead>  
    <tr> 
      <th class="hidden">Column1</th> 
      <th>Column2</th>    
      <th class="hidden">Column3</th> 
      <th>Column4</th>
    </tr>
  </thead>
  <tbody> 
    <tr> 
      <td class="hidden">Value1</td> 
      <td>Isle of Palms</td>   
      <td class="hidden">Value3</td>  
      <td>Value4</td> 
    </tr> 
  </tbody>
</table>      

Then I use the following code to hide the hidden class columns:

$(function() { 
    $('.hidden').hide();
});             

Yesterday some of you told me how to get the first column content by using:

$(function() { 
    $(this).find('td.hidden:first').html();
});             

What I want to do is to show an alert or Thickbox showing the header name and cell value for all the hidden columns:

Column1 = Value1
Column3 = Value3

If it were easier to do, I could group all the hidden columns at the beginning (to the left) of the table.

Thanks in advance.

  • 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-21T06:46:53+00:00Added an answer on May 21, 2026 at 6:46 am

    Try this out

    var mytable = $('#mytable');
    
    $('#mytable > tbody').delegate('tr', 'click', function (e) {
    
        trToShow = $(this);
    
        var keyValueInfo = mytable.find('th.hidden').map(function () {
    
            // for each th.hidden element, get the corresponding "key = value" string
    
            var i = $(this).index(); // get the index of the th element
    
            // get the td element with the same index as the above th, and get the text inside it
            var value = trToShow.find('td.hidden').filter(function () {
                return $(this).index() === i;
            }).text();
    
            // The above could also be done as (Read documentation of :eq selector)
            // var value = trToShow.find('td:eq(' + i + ')').text();
    
            // get the text inside this th element, which would be our key
            var key = $(this).text();
    
            // return the "key = value" string wrapped up in a div element
            return '<div>' + key + ' = ' + value + '</div>';
    
        }).toArray().join('');
    
    });
    
    // Show a dialog with the above content inside it
    show_dialog_with_stuff(keyValueInfo);
    

    Read more up on index

    I haven’t tested it, but if any, there should only be minor silly errors. Tested here http://jsfiddle.net/mb6Gd/

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

Sidebar

Related Questions

I know this maybe a very basic question but I'm having a bit of
Maybe this question is easy,but I can't understand now. String.prototype.self=function() { return this; }
I've looked around, but don't see this question - maybe its too easy, but
Maybe this is an easy question, maybe not. I have a select box where
Maybe this is a dumb question, but is there any way to convert a
Maybe this is a dumb question, but I have the following behavior in Visual
This is related to the this question and the answer maybe the same but
This question is for a web application. And maybe it's a stupid question but
This maybe a stupid question, but as I can not easily undo my change
I know this maybe a basic question but I just can't seem to find

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.