your problem is coming from (this). just try : $(".bc-wrapper:empty").parent().addClass("none");
On Sep 30, 2:09 pm, Vinoj <[EMAIL PROTECTED]> wrote: > I've got the following as my jquery code: > <script type="text/javascript"> > $(document).ready(function() { > $(".bc-wrapper:empty").(this).parent().addClass("none"); > }); > > </script> > > And the html is: > > <div class="bottom-content"> > <div class="bc-wrapper"> > > </div> > </div> > > The css is as follows: > .bottom-content { > display: block; > width: 215px; > border: 1px solid #ccc; > float: left; > margin-right: 20px; > } > .bc-wrapper { > padding: 5px; > } > .none { > visibility: hidden; > border: none; > } > > ---------------------------------- > Basically in this example, I'd like the bottom-content class to be > hidden if the bc-wrapper class has no content. Unfortunately, I > believe I've written my code wrong (in all the different variations > I've tried) for jQuery because nothing is happening. Even when I check > with Firebug, there's no class attached anywhere. > > Any thoughts?