/table-of-contents

Table of Contents with Pure Javascript

Primary LanguageCSSMIT LicenseMIT

Table of Contents with Pure Javascript

How to use:

Just call the function with the content container ID and the ID of the element you want it to display the list.

<article id='article'>
  <!-- Content -->
</article>
<div id='tc' class="block">
  <!-- Here goes the table content generated by JS -->
</div>

Now you just need to call the function.

tc('article','tc', document);

Demo