I need an algorithm that calls only text in a row.
My td consists of numbers and text, I want only text in my “td”.
Demo : http://jsfiddle.net/3yYFY/1
For example:
in second row = accure, alligator, badger
in third row = Zebra, Elephant
There is a lot of rows(td) in my table and the text is not located in a specific column
HTML :
<table id="docsTable">
<tr bgcolor="#E7DDCC" class="liste-0">
<td align="center"><input type="checkbox"/></td>
<td>Document Title 1</td>
<td>567</td>
</tr>
<tr bgcolor="#E7DDCC">
<td align="center"><input type="checkbox"/></td>
<td>accure</td>
<td>134</td>
<td>alligator</td>
<td>badger</td>
</tr>
<tr bgcolor="#E7DDCC">
<td align="center"><input type="checkbox"/></td>
<td>Zebra</td>
<td>231</td>
<td>Elephant</td>
</tr>
</table>
<input type='button' id='btnTest' value='Get Rows' />
jQuery :
$(function() {
$('#btnTest').click(function() {
var arr = $('#docsTable tr').has('input[type="checkbox"]:checked').map(function() {
alert($('td:eq(1)', this).text())
});
});
});
Final UPDATE:
Use this: http://jsfiddle.net/uJdj9/2/
Or like that if you know wich td to discard:
DEMO: http://jsfiddle.net/uJdj9/