JSFiddle - React, Tailwind, and code Playground

HTML

<table>	 <tr>
             <td width="33%" align="center" style="font-size:20px;">4</td>            
             <td width="33%" align="center"><form action="script.php" method="post">
             <input type="submit" value="1" name="THIS IS RANDOM" style="font-size:5px;" class="button">&nbsp;&nbsp;
             <input type="submit" value="2" name="THIS IS RANDOM" style="font-size:5px;" class="button">&nbsp;&nbsp;
             <input type="submit" value="3" name="THIS IS RANDOM" style="font-size:5px;" class="button">&nbsp;&nbsp;
             <input type="submit" value="4" name="THIS IS RANDOM" style="font-size:5px;" class="button">            
             </form></td>
 </tr> 
                 </table>

JavaScript

// check every row
$('table tr').each(function() {
    // check every td in every row
    $(this).find('td').each(function() {
        // set tdValue to the value of the td, cast to integer
        var tdValue = parseInt($(this).html());
        if (tdValue > 0 && tdValue < 10) {
            // find the input with the same value as the td and click it
            // note that as the code stands this will redirect the user
            // $(this).parent().find('input[value='+tdValue+']').click();
        }
    });
});