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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:16:50+00:00 2026-06-05T15:16:50+00:00

fiddle is here . I am having trouble grabbing the actual column by the

  • 0

fiddle is here.

I am having trouble grabbing the actual column by the colgroup’s col id to toggle it. I have the index correctly matched, but I do not understand how I can use the power of the colgroup to grab the entire column. Here is my current attempt (all the way at the bottom on the fiddle):

    //Column Button Hider
    $('fieldset.techtable input.column[type=checkbox]').on('change', function() {
        var index = $(this).prevAll('input.column').length+2;
        console.log(index);
        $('fieldset.techtable' #col'+index').toggle()
            //($('#col'+index).toggle());
    });

and here is the table and colgroup:

<section class="techtable">
        <h1>Technologies / Compliance / Certifications</h1>
        <table cellspacing="0">
            <colgroup>
                <col id="col0">
                <col id="col1">
                <col id="col2">
                <col id="col3">
                <col id="col4">
                <col id="col5">
                <col id="col6">
            </colgroup>
            <thead>
                <tr>
                    <th>Category</th>
                    <th>Skill</th>
                    <th>Version(s)</th>
                    <th>Start Date</th>
                    <th>End Date</th>
                    <th>Elapsed Time</th>
                    <th>Expertise Rating</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>Technology</td>
                    <td>J2EE</td>
                    <td>1.5, 1.6, 1.7</td>
                    <td>November, 2011</td>
                    <td></td>
                    <td></td>
                    <td>2</td>
                </tr>
                </tr>...repeating...</tr>
            </tbody>
        </table>
    </section>

I want to try to utilize the power of the colgroup, but am unsure if I should use class ids (if so, where? on the col group id, the <th>? or each <td>?).

Are the <th>s interfering with the <colgroup>? maybe worded better, should I reference the th instead of trying to use colgroup?

A point in the right direction of syntax is helpful, and a line of code to help is always appreciated, but for this one, I am trying to avoid expanding this into more lines of code, unless im overlooking the methodology. I am under the assumption that I am not just grabbing the col id correctly, but you feedback could prove me wrong.

  • 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-05T15:16:51+00:00Added an answer on June 5, 2026 at 3:16 pm

    If you are trying to hide a particular column of data, hiding the col within the colgroup won’t do it.

    var colIndex = 0; // first column
    $(myTable).find("td,th").filter(":nth-child(" + (colIndex+1) + ")").toggle();
    

    I have modified this code to work with your table. Here’s the updated fiddle

     var index = $(this).prevAll('input.column').length+2;
     $('colgroup').parent('table').find("td,th").filter(":nth-child(" + (index+1) + ")").toggle();  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my current fiddle: http://jsfiddle.net/UjAQf/79/ My target table design is this: But I'm having
Here's the fiddle http://jsfiddle.net/rgbjoy/q9VGh/ I want to have multiple carousels on one page, but
I have a fiddle here - http://jsfiddle.net/hhimanshu/SDr3F/2/ The left pane is already available I
I have a fiddle here http://jsfiddle.net/WULsZ/1/ I load jQuery first and the code is
Here's my fiddle: http://jsfiddle.net/e6kCH/15/ It may sound stupid, but I can't find a way
Here is a fiddle with it centered, but the image with position:relative instead of
We've having trouble deploying a web service that works in our development environment, but
I'm having trouble with cross-browser compatibility. I have a simple menu (with all JS
I have a Jquery Newbie question: Here is my Fiddle: http://jsfiddle.net/NinjaSk8ter/T8TNP/ Here is what
Fiddle is here - http://jsfiddle.net/ashwyn/a45ha/ HTML here - <div class=parent> <div class=a>Class A</div> <div

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.