I have the following code creating a td
html += "<td data-id='test' class='journal' style='max-width:200px;'>"+record.source_account_code+"</td>";
and then the following code
$(document).on('click', '#table-content td', e => {
console.log("td onclick called")
console.log($(this).attr('data-id'))
});
which executes correctly but instead of outputting "test" I get "undefined"
I have tried doing it this way as well
$(this).data("id")