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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:33:41+00:00 2026-05-24T23:33:41+00:00

I have a table <table border=1> <tr> <td rowspan=2>September</td> <td>Jim</td> </tr> <tr> <td>Dave</td> </tr>

  • 0

I have a table

<table border="1">
    <tr>
        <td rowspan="2">September</td>
        <td>Jim</td>
    </tr>
    <tr>
        <td>Dave</td>
    </tr>
    <tr>
        <td>October</td>
        <td>Fred</td>
    </tr>
</table>

using the code I am able to apply the class Red to the first row of the rowspan only, i.e, only Jim is being highlighed red and not Dave. I also want Dave to have the class Red…Please note I want to apply the class per row and not per cell.

var fullRowNumCells=1;

$('#table tr').each(function(){
    if( $(this).find('td').length==fullRowNumCells){

        if($.trim($(this).find('td:first').html()!=''))
        {

                $(this).addClass("red"); 
         }            
   }            
});
  • 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-24T23:33:41+00:00Added an answer on May 24, 2026 at 11:33 pm

    Keep it simple. For a table with n columns;

    var n = 2;
    var $rows = $('tr').addClass('red');
    
    $rows.has(':nth-child(' + n + ')').removeClass('red');
    $rows.has('[rowspan]').addClass('red');
    

    Sometimes it’s easier to think of what to take away then what to add http://jsfiddle.net/NV8uu/1/

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

Sidebar

Related Questions

I have this block of PHP and HTML: <table width=57% border=0 class=tabela_master id=aps-cat> <tr>
I want to have a table border (which I can set using css, rather
I want the headings of the table to have a red solid border and
I have created a php table like so: echo <table border = '0' cellpadding
I have a table as below; <table style=width: 100%; border: solid 1px #666600; min-width:
I have an HTML table with collapsed and adjacent borders and a standard border
I have following CSS: table tbody tr:last-child td { padding-top: 7px; border-bottom: 0; }
I have the following HTML table: <table style=width: 100%;> <tr> <td class=title_bar_left_border></td> <td class=title_bar_middle></td>
I have problems with CSS. The table is creating white border and I do
I have the following CSS in my header: <style type=text/css> table, td { border-color:

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.