Skip to content

teotimepacreau/Dynamic-Table-of-content-Day16-Of-100DaysOfCode

Repository files navigation

Dynamically generated Table Of Content

Dynamically generated Table Of Content

Project goals

  • Build a dynamic TOC by retrieving h2 ID's and then set anchor link (innerHTML, textContent, Template Literals)

  • Missing IDS are intentionnally set in, so I added function to set custom ID's base on the title of the h2 thanks to object keys (replaceAll(' ', '-').toLowerCase())

  • User can generate a title for the story with the input (parentElement, nextElementSibling, createElement)

🛠️

VanillaJS, CSS, HTML