jQuery selector selecting all rows... why?

Posted by Jagd on Stack Overflow See other posts from Stack Overflow or by Jagd
Published on 2013-07-02T22:56:03Z Indexed on 2013/07/02 23:05 UTC
Read the original article Hit count: 195

Filed under:

I have a standard HTML table that looks something like this in structure:

<table>
  <tbody>
    <tr>
      <td>FOOTER</td>
      <td>
          ... other td columns
      </td>
    </tr>
    <tr>
      <td>some other row that I don't want selected</td>
      <td>
          ... other td columns
      </td>
    </tr>
  </tbody>
</table>

What I would like to do is select only the tr's that contain the text FOOTER in a td, and then set the font-weight to bold for all td's under the selected tr's. My problem is that the jQuery selector I have is setting all td's within the table to bold and I'm not sure why.

Here's my selector thus far:

$("tr:contains('FOOTER')").children("td").css("font-weight", "bold");

© Stack Overflow or respective owner

Related posts about jQuery