JQuery select all rows containing certain text within a td in the row

后端 未结 3 826
温柔的废话
温柔的废话 2021-01-07 19:45

I have a table for which I am attempting to select all rows which have a td containing the text \'Test\' and then hide the td with class \'ms-vb-icon\' on all the matched ro

相关标签:
3条回答
  • 2021-01-07 20:27

    Try:

    $("tr td:contains('test')").each(function(){
      $(this).siblings('td.ms-vb-icon').css("visibility","hidden");
    });
    

    Demo here.

    0 讨论(0)
  • 2021-01-07 20:27

    I guess you are missing ')' .It worked for me:

    $("tr:has(td:contains('1'))").each(function () {
    
    0 讨论(0)
  • 2021-01-07 20:27

    Try with

    $("tr:has(td:contains('test')").each(function(){
        $(this).parent().children(".ms-vb-icon").css("visibility","hidden");
    });
    

    The class .ms-vb-icon is a child of the tr while the $(this) function refer to the td

    0 讨论(0)
提交回复
热议问题