I'm populating a table with PHP code that talks to my database. The PHP echo's code back into the table as separate rows. Each row has a delete button and I want to make that delete button remove the row from the DOM.
echo "<tr><td data-creator='$creator'>{$comment}<a class='deleteComment'
data-role='button' data-icon='delete' data-iconpos='notext';></a></td></tr>";
// php code ends
<script type='javascript'>
$(".deleteComment").click(function () {
$(this).parent().remove();
});
</script>
This won't work. And when I put a console.log statement into the .deleteComment function, nothing prints to the console when I click on the delete button within a row.