I am having a bit of trouble with this one. Thanks for your help. I could get it working if the parent is a <div> but not if it's an <li>.
Here's my html: <ul class="member-table"> <li> <div><strong>Why I am involved:</strong></div> <div class="answer">{tag_why are you involved?}</div> </li> <li> <div><strong>Current projects & activities:</strong></div> <div class="answer">{tag_current projects}</div> </li> <li> <div><strong>My relevant experience:</strong></div> <div class="answer">{tag_relevant experience}</div> </li> </ul> Here's my jQuery: $('.answer').each(function() { if ($(this).text() == "") { $(this).parents().hide(); } }); You said to add ('ul .answer') but this does not seem to make any difference. I really appreciate your help on this. Jack On Oct 1, 3:34 pm, Wacko Jacko <jackson.be...@gmail.com> wrote: > Brilliant! I will try this and get back to you.Thanks for your time! > > On Oct 1, 3:21 pm, Charlie Griefer <charlie.grie...@gmail.com> wrote: > > > Assuming you can turn those id's into classes (where you have > > id="database")... you can do the following: > > > $(document).ready(function(){ > > $('ul .database').each(function() { > > if ($(this).text() == "") { > > $(this).parent().hide(); > > } > > }); > > > }); > > > On Wed, Sep 30, 2009 at 10:14 PM, Charlie Griefer <charlie.grie...@gmail.com > > > > wrote: > > > If you're working with server side data like that, couldn't you just write > > > a conditional in whatever language you're using (PHP, CF, ASP, etc) to not > > > display the <li> if no data? > > > > Also, do you really mean to re-use "database" as an ID for multiple > > > elements? ID's ought to be unique. > > > > On Wed, Sep 30, 2009 at 9:43 PM, Wacko Jacko > > > <jackson.be...@gmail.com>wrote: > > > >> Hi All, > > > >> If I had a list displaying data as follows: > > > >> <ul> > > >> <li id="item"><div>Label Here</div><div id="database">{content > > >> here if available from database}</div></li> > > >> <li id="item"><div>Label Here</div><div id="database">{content > > >> here if available from database}</div></li> > > >> </ul> > > > >> Could I hide the whole <li id="item"></li> if their is nothing > > >> available to show from the database in <div id="database"> ? > > > >> Thanks in advance for your help > > > >> Jack > > > > -- > > > Charlie Griefer > > >http://charlie.griefer.com/ > > > > I have failed as much as I have succeeded. But I love my life. I love my > > > wife. And I wish you my kind of success. > > > -- > > Charlie Grieferhttp://charlie.griefer.com/ > > > I have failed as much as I have succeeded. But I love my life. I love my > > wife. And I wish you my kind of success.