Select only with some class before a button using jquery

前端 未结 1 1524
[愿得一人]
[愿得一人] 2021-01-26 00:45

i have this html markup and i want to select some rows using jQuery.

When pressing the button with class \'cerrar\' i want to select the 3 tr with class \'hidden

相关标签:
1条回答
  • 2021-01-26 01:34

    You can just do like this:

    $('.cerrar').click(function(){
    
        // Get all the tr's with hidden class before button
        var TRs = $(this).closest('tr').prevUntil("tr.main").andSelf();
    
    });
    
    0 讨论(0)
提交回复
热议问题