Hiding rows related to empty rows using jquery -


I have a table structure to display such terms:

  & Lt; Table & gt; & Lt; Tr & gt; & Lt; Td> Post title & lt; / Td> & Lt; / Tr & gt; & Lt; Tr & gt; & Lt; Td> Postal body & lt; / Td> & Lt; / Tr & gt; & Lt; / Table & gt;   

I want to hide both lines if the body content is empty.

How can I get it using jquery?

To mention that the extracted images have been removed, if they have not loaded correctly, then $ ("img"). Error (work () ($ (this) .remove ();}); Check the source that the html is still there, so it is not considered empty.

this trick:

  $ ('td'). Filter (function () {returns $ .trim ($ (this) .html ()) == '';}). Closest ('.... tr') last () delete () end () delete ();  The problem with  

: Empty is that it should be completely empty - no white space.

Also note that the page Changing through Javascript will not affect the page source, which represents the basic HTML to see the page's "live" status, you must use the element inspector provided by the firebug or the Chrome Developer Tools tool. / P>


A little away from the subject, but I do not know why the structure of the table is necessary. You need to make your markup more meaningful, and work with it. Create knowledge are:

  & lt; article & gt; & Lt; h1 & gt; Post title & lt; / H1> & Lt; P & gt; Post body & lt; / P & gt; & Lt; / Article & gt;   

Then jQuery can be simplified:

  $ ('article p'). Filter (function () {return $ .trim ($ (this) .html ()) == '';}) closest ('article'). Remove ();    

Comments