Philosophy bubble is like a quote/speech bubble div styled which has a sharepoint control inside, the richHtmlField which lets users to type in content while editing page, but if the user chooses to leave it empty, there will be no content in the div so only the bubble will show up in the page which will look funny so i wanna hide the whole div when there is no user entry or basically the div is empty?? How do you do this in jquery?
<div class="philosophy-bubble">
<PublishingWebControls:RichHtmlField FieldName="carephilosophy" runat="server"></PublishingWebControls:RichHtmlField>
</div>
Something like:
here is a fiddle: http://jsfiddle.net/IrvinDominin/XYr9T/1/
EDIT
better by using:
http://jsfiddle.net/IrvinDominin/XYr9T/3/
Use jQuery's
:empty
selector:Here's a working fiddle.
Alternative
You could also use the
filter()
function to find all empty div's and hide:..etc.
Note: the
:empty
selector will be more performant. See jsPerf.