I have a table as below
<table id="mytable"> <tr><th>checked</th><th>id</th><th>text</th></tr> <tr><td><input id="cb1" type="checkbox" name="checker1"/></td><td>123</td><td>abc</td></tr> <tr><td><input id="cb1" type="checkbox" name="checker1"/></td><td>456</td><td>def</td></tr> <tr><td><input id="cb1" type="checkbox" name="checker1"/></td><td>789</td><td>ghi</td></tr> </table>
I want to get (using jquery) a javascript array of all verified identifiers in a table.
So far I have the following jquery code, which, when I click the jqcc button, brings me a warning window for each of the selected elements, so instead of warning, I need to get the value of the second td and add it to the array,
$(document).ready(function() { var tableControl= document.getElementById('mytable'); $('#jqcc').click(function() { $('input:checkbox:checked', tableControl).each(function() { alert('checked'); }); }); });
source share