JSFiddle - React, Tailwind, and code Playground
HTML
<table id="oustandingItems">
<tr><th>Category</th></tr>
<tr><td><input name="mytest" /></td></tr>
<tr><td><input name="mytest" value="123"/></td></tr>
<tr><td><input name="mytest" /></td></tr>
<tr><td><input name="mytest" /></td></tr>
</table>
<button id="findRow">Find Row</button>
<input type="text" id="myRow" />
JavaScript
$("#findRow").click(function() {
var tableRow = $('#oustandingItems tr:has(td input[value!=""])').prevAll().length;
$("#myRow").val(tableRow);
});