Reputation: 3411
I have the following code:
var table = $("#b-table");
table.find('tr').each(function (i) {
var $tds = $(this).find('td'),
qLine = $tds.eq(0).text(),
qPartNumber = $tds.eq(1).text(),
qComments = $tds.eq(5).val();
console.log(qLine);
console.log(qPartNumber);
console.log(qComments);
});
qLine and qPartNumber are copying over fine, as these are text values within the td
element, but qComments is not copying over, as within the td
element is another input
element, like so:
<td><input class="qComments" type="text"></td>
I've tried using:
$tds.eq(5).val();
$tds.eq(5).html();
$tds.eq(5).text();
$tds.input.eq(5).val();
$tds.eq(5).input.val();
and none of these capture the value of the input - and the last two error out for bad syntax.
Upvotes: 1
Views: 178