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

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -