I am using jquery trying to retrieve the value of a text input but it is not working. can anyone see what I am doing wrong? http://jsfiddle.net/silvajeff/4Sb8K/3/
<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" />
$("#findRow").click(function() {
var tableRow = $('#oustandingItems tr:has(td input[value!=""])').prevAll().length;
var myValue = $('#oustandingItems input:has(td input[value!=""])').val();
$("#myRow").val(myValue);
});
You can simplify your selector to
#oustandingItems tr input[value!=""]JSFiddle