JSFiddle - React, Tailwind, and code Playground

by Dwza

HTML

<table>
  <tbody>
    <tr my-attr='333'>
      <td attribute1='123'><span>yes</span></td>
      <td attribute1='123'><span>yes</span></td>
      <td>no</td>
      <td>no</td>
      <td attribute1='123'>yes</td>
    </tr>
    <tr>
      <td>no</td>
      <td>no</td>
      <td>no</td>
      <td>no</td>
      <td>no</td>
    </tr>
  </tbody>
</table>

<table class="result">

</table>

CSS

td:not([attribute1='123']){
  background:red;
}
td[attribute1='123']{
  background: limegreen;
}
td{
  text-align: center;
  width: 30px;
}

JavaScript

$(".result").html(document.querySelectorAll("tbody > tr[my-attr='333'] > [attribute1='123']"));