html - jquery Hide table row if td has no text -
i trying hide table row if rows td has no text inside it. how that. far tried at fiddle here
javascript:
$('#tblnodes > tbody > tr').each(function () { if ($td.text() == '') { $(this).hide(); } });
html:
<table id="tblnodes" border=1 width=100%> <tr> <td class="nodedata"></td> </tr> <tr> <td class="nodedata">abc</td> </tr> <tr> <td class="nodedata"></td> <tr> <td class="nodedata"></td> </tr> <tr> <td class="nodedata">abc</td> </tr> <tr> <td class="nodedata"></td> </tr> </tr> </table>
try
$('#tblnodes > tbody > tr').has('td:empty').hide()
or
$('#tblnodes > tbody > tr td:empty').parent().hide()
Comments
Post a Comment