for the life of me i can't understand why my code doesn't work...
<!-- language: lang-html -->
<table id='table'>
<tr id='some-id'>
<td>some data</td>
<td>some data</td>
</tr>
</table>
my first attempt:
<!-- language: lang-js -->
$(() => {
$('#table tr').on('click', () => {
console.log($(this).prop('id'))
}
}
second thoughts:
<!-- language: lang-js -->
$(() => {
$('#table').on('click', 'tr', () => {
console.log($(this).attr('id'))
}
}
it keeps returning undefined
i feel really dumb for messing this up, any help would be massive right now thanks in advance!