jquery - Hide div's if they are empty -


I have some div that can be empty (depending on server side logic).

  & lt; Div id = "bar" & gt; & Lt; Div class = "section" style = "display: block;" & Gt; & Lt; / Div & gt; & Lt; Div class = "section" style = "display: block;" & Gt; & Lt; / Div & gt; & Lt; Div class = "section" style = "display: block;" & Gt; & Lt; / Div & gt; & Lt; / Div & gt;   

If there is no HTML inside their div (with square section), then I want to hide them.

How can I do this?

If jQuery is the selector, then you can do this:

 < Code> $ ('div.section: empty'). Hide ();    

Comments