Getting a parent element for a jquery selector

后端 未结 3 1735
轻奢々
轻奢々 2020-12-10 10:25

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'));
    });
    

提交回复
热议问题