vendredi 20 mars 2015

How to get value and text row checked in table using Jquery?

I have a table with struct follow, I want to get value row checkbox in table using jquery.Example:





<table border="1" width="100%">
<thead>
<tr>
<td><input type='checkbox' />No</td>
<td>Header Col2</td>
<td>Header Col3</td>
</tr>
</thead>
<tbody><tr>
<td><input type="checkbox" class="chk" name="chk_id_local" id="bt_check" value="L01"/>&nbsp;1</td>
<td> Row 1</td>
<td> Row 1</td>
</tr>
<tr>
<td><input type="checkbox" class="chk" name="chk_id_local" id="bt_check" value="L02"/>&nbsp;2</td>
<td> Row 2</td>
<td> Row 22</td>
</tr>
<tr>
<td><input type="checkbox" class="chk" name="chk_id_local" id="bt_check" value="L03"/>&nbsp;3</td>
<td> Row 3</td>
<td> Row 333</td>
</tr>
</tbody>
</table><br>
<button id="bt1">Get</button>



And now, when I click checkbox a row in table, then i click button Get , I will get value in row follow. Example click checkbox row 2 and click button Get, value with return: L02,2,Row 2,Row 22 . Thank for your advice.


Aucun commentaire:

Enregistrer un commentaire