I have an html files with h1 and h2 elements.
What is the best way and how to create a Table of Contents in this file using these elements?
Any way to automate the process or I have to settle for creating the TOC manually?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I would do this on the server side using any language of your choice, and then cache the results and display them every time. Don’t bother doing this in javascript because it will be work that needs to be repeated everytime.
The better approach might even be to parse the file, put in a database and the just display the TOC with an easy
SELECTstatement.