I have a table like
<table class="table-striped col-lg-12" id="resultsTable" >
<thead>
<tr>
<th>
Include?
</th>
<th>
Organization
</th>
<th>
Category
</th>
<th>
Orginal File Name
</th>
<th>
Link to File on Server
</th>
<th>
</th>
</tr>
</thead>
<tbody id="results">
<tr>
</tr>
</tbody>
</table>
and the tbody
gets built out with button
s inside its td
s after the user has triggered a particular event. I think the reason that my
$(function () {
$('table button').click(function () {
console.log("ok, it got clicked");
$('#file2Download').val($(this).closest('tr').find('td:first').text());
$(this).parents('form:first').submit();
});
});
isn't working is because the td
s aren't in the DOM on page load. Is there a good workaround for this or do I need to add in hidden td
s or what?