jQuery - find table row containing table cell containing specific text

前端 未结 5 1730
孤街浪徒
孤街浪徒 2020-12-07 22:21

I need to get a tr element which contains a td element which contains specific text. The td will contain that text and only that text

5条回答
  •  星月不相逢
    2020-12-07 22:33

       
    
    PHP
    MySql
    AJAX
    jQuery
    JavaScript
    HTML
    CSS
    CSS3
    $("#textbox").on('keyup',function(){ var f = $(this).val(); $("#table_data tr.listR").each(function(){ if ($(this).text().search(new RegExp(f, "i")) < 0) { $(this).fadeOut(); } else { $(this).show(); } }); });

    Demo You can perform by search() method with use RegExp matching text

提交回复
热议问题