Welcome to WebmasterWorld Guest from

Forum Moderators: Robert Charlton & aakk9999 & andy langton & goodroi

Message Too Old, No Replies

Hiding list with javascript -- bad for Google?

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

New User

5+ Year Member

joined:July 6, 2007
posts: 12
votes: 0

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 Sept 28, 2007 (gmt 0)

Senior Member

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

joined:May 26, 2000
votes: 0

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.

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members