JSFiddle - React, Tailwind, and code Playground

HTML

<table>
  <thead>
    <tr>
      <th>Col A</th>
      <th>Col B</th>
    </tr>
   </thead>
   <tbody>
     <tr><td>Val X</td><td>ValY</td></tr>
     <tr><td>Val A</td><td>Val B</td></tr>
   </tbody>
</table>

TypeScript

function findCellByRowTextColumnHeaderText(rowText: string, columnName: string) {
    const row = $(`tr:contains(${rowText})`);
    const columnIndex = $(`th:contains(${columnName})`).index();
    return row.find(`td:eq(${columnIndex})`);
  }
  
  const cell = findCellByRowTextColumnHeaderText('Val A', 'Col B');
  cell.css('color', 'blue');