JSFiddle - React, Tailwind, and code Playground

HTML

<table>
    <tr>
<td class="tdTextInput">
        <input type="text" value="0" name="txt1_9_4_2" id="txt1_9_4_2" class="input-supermini">
    </td>
        </tr>
    </table>

JavaScript

//focus the textbox on td click
        $('.tdTextInput').mousedown(function ()
        {
            $(this).find('input').first().focus();
        });

        //select all text on focus
        $('.tdTextInput input').focus(function ()
        {
            var isSelected = $(this).attr('data-selected') == 'true';
            if (!isSelected) {
                $('input[data-selected]').removeAttr('data-selected');
                $(this).attr('data-selected', 'true');
                $(this).select();
            }
        });