Picture information within a cell
Picture information within a cell
Dane Jurkovic
Posts: 12Questions: 6Answers: 0
Hello and thank you to anyone that helps me with this problem...
I can see what is in the 4th cell of the selected row using the code below. But how can I find the value that is set for the ALT tag for the image within that cell?
<table id="myTable" class="table table-striped table-bordered table-hover">
<th>...</th>
<th>...</th>
<th>...</th>
<th>...</th>
<th>...</th>
<th>...</th>
<th>...</th>
</tr>
<tr>
<td>...</td>
<td>...</td>
<td>...</td>
<td><img id='row304' src='images/Eye.png' alt='Red'/></td>
<td>...</td>
<td>...</td>
<td>...</td>
</tr>
</table>
$("#myTable").on('click', '.btnSelect', function () {
var currentRow = table.row($(this).closest("tr")).data();
alert('Manager: ' + currentRow[3]);
alert('This is the alt tag for an image tag');
});
Thanks again....
This discussion has been closed.
Answers
Since Datatables doesn't know about attributes, etc you will need to use jQuery (or your preferred method) to get the img attribute. For example:
$(this).closest("tr").find("td:eq(1) img").attr('alt')
Might be an easier way but this one worked for me.
Kevin