javascript - Jquery .eq plus contains -
when trying [tr] second [td] contains information, keep getting stuck on logic. here example.
<table class="todos"> <tbody> <tr> <td>info1</td> <td>info2</td> <td>info3</td> </tr> </tbody> </table>
and here javascript find me...
$(".todos tbody tr").css('display','none'); $(".todos tbody tr").each(function(){ if($(this).find("td:eq(0):contains("+procurar+")")) $(this).css('display','table-row'); if($(this).find("td:eq(1):contains("+procurar+")")) $(this).css('display','table-row'); });
you're hiding parent tr
, setting display property on td
's won't show them, if that's not intended functionality, i'd do:
$(".todos tbody tr").hide().find('td:lt(2)').filter(function() { return $(this).text().indexof(procurar) != -1; }).closest('tr').css('display','table-row');
Comments
Post a Comment