Using JQuery I append a tr where one of the td's includes a checkbox. It appears nicely on the screen. However I want to select one of the checkboxes and trigger a function on click. For some reason the selector does not see the appended checkbox. I presume thta this is because the checkbox is not actually within the HTML source code.
So, Question: what do I do to select this checkbox ?
$.each(categories, function (i, product) {
$(".table_products").append('<tr class="empty"><td >' + product.product_name + '</td><td>' + product.price + '</td><td> <input type="checkbox" value="cat_id"></td></tr>');
$("tr").addClass("cat_products");
});
$("td input:checkbox").on('click', function () {
alert('line 41');
});