title: Adding a class and ID to headers using Javascript
body: <p>The way that Zendesk's Help Centre works is by printing all the sections onto the page without giving them any unique identifier, so it's a pain if you want to implement any sort of scrollspy (updating a sidenav with where you are on the page), and most importantly anchors so that the sidenav actually works.</p>
  
  <p>I'm not that technical and was wondering if anyone knew of a way to add an ID &amp; class to a series of headers using JS?</p>
  
  <p>I'm thinking for each <code>h2</code> in <code>section-tree-with-article</code>, adding a unique ID, and a class that matches the h2's text?</p>
  
  <p>Any thoughts?</p>
  
  <p><img src="https://i.stack.imgur.com/jqVwt.png" alt="Help Centre"></p>
  
  <p><img src="https://i.stack.imgur.com/xQM5I.png" alt="Source code"></p>