Categories
Writing

jQuery Table of Contents

This is a heading

There are occasions when you want to be able to preview the headings that come further down the page, but you won’t want to have to maintain them every time the content might change. This is where this little snippet of jquery comes in handy. It takes all the H2 elements on the page and adds them to an unordered linked list, and appends the required anchor tags to the H2 elemetns.

This example is a little bit shit, because I haven’t omited the H2’s in for the related links. You know what though, I’m bloody busy right now and have other things to do…. so just make sure you target the right areas ;)

Below is the JSFIDDLE code to copy

This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a 3rd heading

This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.

Antoher Level 2

This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of difThis is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.fernent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a 3rd heading

This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of diffThis is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.ernent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a 3rd heading

This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.

This is a lot of content theis is a lot of differnent content and event more if you want it.

Leave a Reply

Your email address will not be published. Required fields are marked *