Reputation: 36227
I have a table 'mytable' that looks like:
<tr>
<td><input type="checkbox" name="check[]" value="11"></td>
<td>11</td>
<td>2014-11-06 18:49:26</td>
<td>MESSAGE</td>
<td></td>
<td>MATCH5</td>
<td>NO MATCH</td>
<td>NO MATCH</td>
</tr>
I want to get the value of column 4 "MESSAGE" from a row if its checked. In How to get value of table cell with jquery from checkbox using absolute row number it was shown that
var ids = $('table input:checked').map(function(){
return $(this).closest('tr').find('td:eq(3)').text();
});
returns
Object["MESSAGE"]
How can I get just the contained text/html ?
Upvotes: 0
Views: 40
Reputation: 490153
Call get()
at the end, to get an array. The values will be in that array.
var ids = $('table input:checked').map(function(){
return $(this).closest('tr').find('td:eq(3)').text();
}).get();
Otherwise, you just have a jQuery collection pointing to a bunch of strings.
Upvotes: 1