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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:19:28+00:00 2026-05-13T12:19:28+00:00

Ok here is my HTML (One row of about 20) <tr class=post-unauth message-unread> <td>

  • 0

Ok here is my HTML (One row of about 20)

<tr class="post-unauth message-unread">
  <td>
    <input class="check-read" type="checkbox" checked="checked" value="68"/>
  </td>
  <td class="message-description" title="Post Title">
  </td>
  <td class="message-author">Name</td>
  <td class="message-dates">3 hours ago</td>
  <td class="message-commentcount" title="0 comment(s)">
  </td>
</tr>

Now when the checkbox is clicked I need to change the class of the parent

$('.check-read').click(function() {
         $(this).parent().parent().removeClass('message-unread').addClass('message-read');
});

I’m missing somthing obvious I think as this doesnt work (Doesnt error) but nothing changes.

I even tried setting the CSS background color and no change to the HTML.

Any suggestions?

  • 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-13T12:19:29+00:00Added an answer on May 13, 2026 at 12:19 pm

    I think you should try closest. This is new in jQuery 1.3

    $(this).closest("tr").removeClass('message-unread').addClass('message-read');
    

    closest docs

    As Mark mentions in the comment below, using a class would be more suitable here since it is less likely to be affected by changes in your table structure.

     $(this).closest(".message_row").removeClass('message-unread').addClass('message-read');
    

    And then add “message_row” to your tr. If an unchecked box is guaranteed to have message-unread class then you can use it for your selector instead of adding a message_row class and selecting on it.

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

Sidebar

Related Questions

Consider the following example: ( live demo here ) HTML: <div class=board> <div class=row>
Before any one suggests HTML, I explain later why thats not an option here.
Fiddle is here - http://jsfiddle.net/ashwyn/a45ha/ HTML here - <div class=parent> <div class=a>Class A</div> <div
I have html like so: <div class=foo> (<a href=forum.example.com>forum</a>) <p> Some html here.... </div>
Here is my HTML: <tr> <td colspan=2 class=borderBottomCell> <div class=benefitInfo style=WIDTH: 99%! important;> <asp:DropDownList
Here is my HTML: <div id=leftMenuWrapper> <div id=ramps class=leftMenuHeaderButton></div> <div id=carServiceRamps class=leftMenuSubButton></div> <div class=clear></div>
Here is my HTML: <li> <div class=menu_inner> <a href=#> <div class=button><img class=486 src=images/portalbutton.png /></div>
I have a table with one row in my HTML file. Now in jQuery
I'm am attempting to get the value of one input in a table row
Here's a Fiddle for what I'm about to discuss. I have three input boxes

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.