I have a table (id=”deneme”).
I need to iterate through the td value, determine which checkboxes the user has checked, and for the rows with a checked checkbox, grab the value for the only text(literal) of middle column.
Maybe for first letter can be defined an algorithm.
<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>
</tr>
<tr bgcolor="#E7DDCC">
<td align="center"><input type="checkbox"/></td>
<td>Zebra</td>
<td>231</td>
</tr>
</table>
<input type='button' id='btnTest' value='Get Rows' />
$(function() {
$('#btnTest').click(function() {
$('#docsTable input[type="checkbox"]:checked').each(function() {
var $row = $(this).parents('tr');
alert($row.find('td:eq(0) input').val());
alert($row.find('td:eq(1)').html());
alert($row.find('td:eq(2)').html());
});
});
});
Demo :
http://www.jsfiddle.net/3yYFY/
How can i do that?
Thanks in advance.
You can use
hasandmapmethods and store the values an in array.http://jsfiddle.net/twn2W/