How do I hide the javascript on a link?

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
Use a click handler rather than the href attribute. You can set one in JS using DOM event registration (create a wrapper around addEventListener/attachEvent to make it cross-browser) or the onclick property, or set it inline using the onclick attribute. Just make sure your code degrades gracefully if JS is disabled or unsupported. There are other solutions, but this is the simplest.

The tutorial uses <div>s for the menu system. Since a menu is a list of links and submenus (which are themselves lists of ...), consider using <ul>. If you later want to change the layout, you'll find that using lists means you won't need to change the document structure.

See also jQuery's UI/Accordion widget and the scriptaculous based accordion.
 
Last edited:
Top