In a view of a MVC app a table is presented to the user. This table doesn't have a head row, only the <tbody>
rows. Each row has a column with the name of a document and a button to delete it, as below:
<table>
<tbody>
<tr id="doc-AD201">
<td>AD201</td>
<td class="text-right">
<button class="excluir" data-id="AD201" title="Delete the document">Delete</button>
</td>
</tr>
<tr id="doc-AD504">
<td>AD504</td>
<td class="text-right">
<button class="excluir" data-id="AD504" title="Delete the document">Delete</button>
</td>
</tr>
</tbody>
</table>
Well, to accomplish this I wrote the following jQuery function:
$('.excluir').click(function () {
$('#doc-' + $(this).data('id')).fadeOut();
});
It's not working. Why? I have a similar code to these in another view and it's working perfectly. What am I doing wrong? What am I missing?