User Name
Password
AppleNova Forums » Programmer's Nook »

HTML : Hide a list if no item inside


Register Members List Calendar Search FAQ Posting Guidelines
HTML : Hide a list if no item inside
Thread Tools
dmegatool
Custom User Title
 
Join Date: Jul 2006
Location: At home
 
2012-09-21, 10:55

Hey guys !
I need to hide a <li> (it's a menu item with sub-items) if there's no other <ul><li> or <a> in it. Can it be done in php or do I need to use Javascript ? I'm pretty beginner in both, anyone can help me out on this one ?

The item that needs to be removed can be set to css display:none, it's not critical if it's rendered then hidden...

So the "class1" <li> wouldn't be shown :
Code:
<ul> <li class="class1">This is a list item</li> </ul>
"class2" <li> would be shown, class3 not:
Code:
<ul> <li class="class2"><a href="#">Open sub menu</a> <ul> <li class="class3">This is a subitem</li> </ul> </li> </ul>

Dave Mustaine :"God created whammy bars for people who don't know how to solo."

Last edited by dmegatool : 2012-09-21 at 11:05.
  quote
Gargoyle
http://ga.rgoyle.com
 
Join Date: May 2004
Location: In your dock hiding behind your finder icon!
 
2012-09-21, 11:38

Mike life easy on yourself and add some extra classes with php.

Also, there are a shit-tonne of javascript + css dropdown, pop-up, slide-out bound in menu systems if you search around google.

http://www.alistapart.com is always a good place to start for this kind of thing.

OK, I have given up keeping this sig up to date. Lets just say I'm the guy that installs every latest version as soon as its available!
  quote
Posting Rules Navigation
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Post Reply

Forum Jump
Thread Tools
Similar Threads
Thread Thread Starter Forum Replies Last Post
Quotes and html entities in MySql and HTML nassau Programmer's Nook 4 2006-10-02 03:39
New store item alcimedes AppleOutsider 22 2006-06-29 21:21
do something for each item in array except last one nassau Programmer's Nook 13 2006-01-14 15:01
Removing Stubborn Item From Start Up List stacy Genius Bar 3 2006-01-07 11:42
Help with removing item from finder... .Hack Genius Bar 3 2005-07-12 22:50


« Previous Thread | Next Thread »

All times are GMT -5. The time now is 06:38.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004 - 2024, AppleNova