I have a table where each row has a CSS id like this:
... ... .. 3条回答 再見小時候 (楼主) 2020-12-10 10:39 Use closest(): $('.anotherclass').click(function () { alert($(this).closest('tr').prop('id')); }); 0 讨论(0) 查看其它3个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复 热议问题
Use closest():
$('.anotherclass').click(function () { alert($(this).closest('tr').prop('id')); });