Welcome to WebmasterWorld Guest from

Message Too Old, No Replies

Hiding list with javascript -- bad for Google?



1:05 am on Sep 28, 2007 (gmt 0)

5+ Year Member

I'd like to add a UL list to a page using CSS and javascript to allow the user to expand and collapse the nodes in the list. The list itself will just be a normal UL/LI HTML list and there will be CSS classes for both expanded and collapsed nodes. The CSS class for a collapsed node is basically defined as "display: none".

I would like the list to be collapsed by default so that a user has to click to expand the list if they want to see all the subitems, in order to cut down on clutter, however, I would still like Googlebot to index the subitems in the list.

I was thinking about doing this by having a javascript load with the page and setting the style of the nodes to the collapsed style (display: none). First of all, will this cause Googlebot to not like my site? I wouldn't think so, as this seems like a valid navigational technique used by lots of sites, but I want to make sure. Also, will this actually do what I'd like, or will Google see that the javascript is hiding the nodes by default and therefore never index them? Thanks for any help.


2:19 am on Sep 28, 2007 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

This is a very common kind of scripting for the divs in dhtml menu systems. If the list contains directly readable html links - not generated by a script but the urls are right there in the page's source code - then there is no problem with using a js to switch CSS display rules.

Featured Threads

Hot Threads This Week

Hot Threads This Month