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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:49:39+00:00 2026-06-15T16:49:39+00:00

I am just diving into jquery, so please excuse any really silly mistakes… I

  • 0

I am just diving into jquery, so please excuse any really silly mistakes…

I have a table I am generating from a database.

<table id="DataTable">
    <tr>
        <th><input type="button" onclick=doCheck()></th>
        <th>col 2</th>
        <th>col 3</th>
        <th>col 4</th>
        <th>col 5</th>
    </tr>
    <tr>
        <td><input type="checkbox" /></td>
        <td>data 2</td>
        <td>data 3</td>
        <td>data 4</td>
        <td class="thisOne">data 5</td>
    </tr>
 .
 .
 .
  </table>

I need to perform some validation checks on column5, labeled thisOne, based on whether or not it is in a row where the box is checked. Here is what I have so far:

//Get checkboxes
var boxes = $("#DataTable").find("tr td input[type=checkbox]");
var locations = [];
boxes.each(function (index, element) {
        if ($(element).is(':checked')) {
            //Code here
        }
    });

In the area marked //code here I have tried many things and have not been able to successfully select the column I want. Some things I have tried (NOTE: I am using Hide() for testing purposes):

$(this).closest("td").next('.thisOne').hide(); Doesn't work
$(this).parent("td").next('.thisOne').hide();  Doesn't Work
$(this).closest("td").hide();                  Works as expected
$(this).closest("td").next().hide();           Works as expected
$('.thisOne').hide();                          Works as expected

Shouldn’t the first line I listed work? .closest() will navigate up to the td level, where .next('thisOne') will traverse the DOM until a td tag with that class is found? Please explain any answers as I am really curious as to why this is not working. 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-06-15T16:49:41+00:00Added an answer on June 15, 2026 at 4:49 pm

    What you need is .siblings()

    $(this).closest('td').siblings('.thisOne').hide();
    

    Also since #datatable is a table, you do not need to specify tr td.. just go for the checkbox..

    var boxes = $("#dataTable :checkbox");
    

    Finally checked is also a property of the checkbox, so no need to query for it through jQuery.. You can use element.checked.

    Altogether

    var boxes = $("#dataTable :checkbox");
    var locations = [];
    boxes.each(function () {
            if ( this.checked ) {
                //Code here
                $(this).closest('td').siblings('.thisOne').hide();
            }
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm just diving into the exciting world of facebook app creation, but have already
I'm just diving into Datamapper (and Sinatra) and have a question about associations. Below
I'm just diving into ActiveRecord and have not been able to find an answer
I just started diving into Go recently and I have one major point of
Before diving into Wordpress just wanted to see if it is possible to have
I'm just diving into WPF and find this a little odd and frustrating to
I just started diving into the world of Rails by reading the well known
I just recently started diving into Real World Haskell and the book provides some
I've just started diving in to the crazy world that is perl and have
I'm diving into writing a mobile app with jQuery Mobile/PhoneGap. I'm using this sample

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.