I've tried that script, but why the jquery doesn't work?? I'm newbie in jquery. I write like these : <script type="text/javascript"> $(document).ready(function(){ $('.main ul').each(function(){ var $this = $(this), lis = $this.find('li:gt(9)').hide(); if(lis.length>0){ $this.append($('<li>').text('More').click(function(){ lis.toggle(); $(this).text($(this).text() === 'More' ? 'Less' : 'More'); })); } }); });
</script> <body> <ul id="narrow-search"> <li class="main"> Category <ul> <li>Category Name</li> <li>Category Name</li> <li>Category Name</li> <li>Category Name</li> <li>Category Name</li> <li>Category Name</li> <li>Category Name</li> <li>Category Name</li> <li>Category Name</li> <li>Category Name</li> </ul> <ul style="display:none;"> <li>Category Name</li> <li>Category Name</li> <li>Category Name</li> <li>Category Name</li> <li>Category Name</li> <li>Category Name</li> <li>Category Name</li> <li>Category Name</li> </ul> <a href="#">more</a> </li> <li class="main"> Brand </ul> <ul style="display:none;"> <li>Brand Name</li> <li>Brand Name</li> <li>Brand Name</li> <li>Brand Name</li> <li>Brand Name</li> <li>Brand Name</li> <li>Brand Name</li> <li>Brand Name</li> <li>Brand Name</li> <li>Brand Name</li> <li>Brand Name</li> <li>Brand Name</li> <li>Brand Name</li> <li>Brand Name</li> <li>Brand Name</li> <li>Brand Name</li> <li>Brand Name</li> <li>Brand Name</li> <li>Brand Name</li> <li>Brand Name</li> <li>Brand Name</li> <li>Brand Name</li> <li>Brand Name</li> <li>Brand Name</li> </ul> <a href="#">more</a> </li> <li class="main">etc...</li> </ul> </body> ... Can you help me,Charlie??? thanks before.. On Thu, Oct 15, 2009 at 10:48 AM, Charlie <charlie...@gmail.com> wrote: > there was some very interesting code on this list a few months ago that > should help you out > > couldn't get the thread from google group search but can see whole thread > here > > http://www.mail-archive.com/jquery-en@googlegroups.com/msg77035.html > > look toward end of thread for mkmanning solution, short and sweet > > > > > dEwA nich wrote: > > Dear friends, > > I'm looking for jquery scripts to show/hide element in unordered list like > http://bbc.co.uk with +, - button. I've got some script from here : > http://paste.pocoo.org/show/86584/ and > http://www.killersites.com/forums/topic/780/jquery-add-remove-list-item/. > But I little confused to use them. They just can be used if I have one > unordered list. If I have two or more unordered list, the script won't work. > > Can somebody help me?? > > thanks before.. > > >