I am trying to trigger a custom event when new rows are added to the table. Below is the code I am using but the event is not firing.
<!DOCTYPE html>
<html lang="en">
<head>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
</head>
<body>
<div id="container">first div</div>
<script>
$( document ).ready(function() {
$( "table#t-result-data tbody" ).on( "update", function() {
console.log('tr id' );
});
function appendToTable() {
var htmlStr;
htmlStr = "<table id='t-result-data'><tbody><tr><td>First Row First column</td></tr></tbody></table>";
$("#container").html(htmlStr)
$('table#t-result-data').trigger('update');
}
appendToTable();
});
</script>
</body>
</html>
What am I doing wrong. The table and its rows are dynamically added