Get a free trial // Grow your CSS skills // Land your dream job

[jquery] Trying to create a dynamic TOC nested list

  • # September 15, 2008 at 8:23 am

    Hey fellow css and jquery fans,

    (i hope it’s okay to post this here as i saw other jquery threads around. Maybe there should be seperate jquery forum?)

    i am trying to pull all headings out of a page and create a unordered
    list in the sidebar, which should then act as navigation help.

    $(document).ready(function() {
    $(‘#sidebar #references’).after(“

    I am able to append the anchors, but i can’t create
    the list. I was looking at the wrap-function of jquery, but didn’t
    figure out how to use it in this scenario. Also, i am actually "pulling out" the anchors of the main page so they are "cut & pasted" in the sidebar. Of course, i only want to copy their values..

    Can somebody explain me how to get the copy-value of this.firstChild
    sorrounded by "<li></li>"?

    aah and here is my html markup:


    Thanks in advance,

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed