title: How do I swap triangle icons when doing expanding/collapsing divs with Javascript/CSS
body: <p>I have a div that I want to toggle between displaying or not when a user clicks on a piece of text. I have a javascript function that toggles a div on or off. That works fine. What I don't know how to do is to have a triangle that points to the right or down depending on whether the div is open.</p>
  
  <p>My HTML looks like this:</p>
  
  <pre><code>&lt;a onclick="toggleDiv('myDiv');"&gt;Click here to expand or close div&lt;/a&gt;
  &lt;div id="myDiv" style="display:none"&gt;
     ...
  &lt;/div&gt;
  </code></pre>
  
  <p>How do I add one of those triangles and have it point the right way, ideally with just HTML, Javascript, and CSS? The triangle would appear to the left of the "Click here..." string.</p>
  
  <p>Thanks.</p>