I want to get all <input>, select the name and all data-attributes which are inside the column in the table. I'm stuck, my table loop starts from 5th row instead of starting from 2nd;
var rowNo = jQuery(this).attr("data-row"); jQuery("#example1 table tbody").find('tr').each(function (key, value) { jQuery(this).find('td').each(function (key, val) { var tName = jQuery(this).find('input,select').attr('name'); console.log(tName); }); }); and
<div id="example1"> <table id="Invoice"> <tbody> <tr class="header_table"> <th></th> <th>InvoiceNo</th> <th>InvoiceDate</th> </tr> <tr class="even" name="tr_2"> <td><i class="fa fa-trash-o icon-class" data-row="2"></i></td> <td><input data-cols="1" data-row="2" name="input_[2][InvoiceNo]" type="text"></td> <td><input data-cols="2" data-row="2" name="input_[2][InvoiceDate]" type="text"></td> </tr> ..... ... </tbody> </table> </div> output
"select_[5][Supplier]" "input_[5][Description]" "input_[5][Serial]" "select_[5][AssetType]" "select_[5][PurchasePrice]" "input_[5][PONumber]" tested my the html table
jQuery("table").find('tr').each(function(key,value){ jQuery(this).find('th,td').each(function(key1,val){ console.log(key1); }); }); I get output as:
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 . ... ... ..