I have a table where every row has a hidden control as shown below
<input name="ID" id="ID" type="hidden"/>
But some of them have values and others don’t. How do I filter out the rows that have no value
I know it would be something like
$('#myTable tr').filter(... ???
What I am trying to do is, get the rows where the hidden control has a value, then fetch certain controls and their values from those rows and post them using jquery ajax.
Building off of João’s answer, to get the row you just need to take his second option and traverse up to the parent.
$('#myTable tr input[type="hidden"][value!=""]').parent();That is assuming the hidden input is a direct descendent of the
<tr>. Otherwise you may want to use the jQuery parents() function like so:$('#myTable tr input[type="hidden"][value!=""]').parents('tr');