2016-04-19 14 views
0

そこには数多くの例がありますが、何も私にとってはうまくいかず、Im going nutsです。ここに私のコードです。私は私の質問があり、全体tr5th tdのiタグ属性値に基づくフィルタ表の行

を返却する必要がある私は、複数の行がありますが、私は唯一の第五td第一iattrstopnotifyが含まれている行を表示したい、それが1例(stopnotify="1"

に等しいです。どのように私は私のテーブルの行と第五TDと第一に、私のattr stopnotify="1"

HTML

があるだけショーの行をフィルタリングするためにjqueryのを得るのですか10
<tbody class="searchable"> 
<tr data-index="0" style="display: table-row;"> 
    <td style="text-align: left; width: 20px; ">1</td> 
    <td style="text-align: left; width: 20px; ">testing</td> 
    <td style="text-align: left; width: 20px; "><a href="http://www.example.com/" target="_blank">http://www.example.com/</a></td> 
    <td style="text-align: left; width: 20px; "> 2 <i class="fa fa-search emailsfound" data-toggle="modal" data-target="#myModal" style="cursor:pointer; color:#397eb9" id="1" title="testing"></i></td> 
    <td style="text-align: left; width: 20px; ">0 <i class="fa fa-times-circle stopnotify" client_id="1" stopnotify="1" title="testing" style="cursor:pointer; color:red"></i></td> 
</tr> 
</tbody> 

jQueryの

$('tbody').addClass('searchable'); 
$('.stopped_notify').on('click', function() { 
    $('.searchable tr').hide(); 
    $('.searchable tr td:nth-child(5) i').filter(function() { 
     return $(this).attr('stopnotify') == 1; 
    }).show(); 
}); 

答えて

0

私はついにそれを考え出しました。ここにjqueryがあります

$('tbody').addClass('searchable'); 
$('.stopped_notify').on('click', function() { 
    $('.searchable tr').hide(); 
    $('.searchable tr td:nth-child(5) i').filter(function() { 
     return $(this).attr('stopnotify') == 1; 
    }).closest('tr').show(); 
}); 
関連する問題