title: JS variable not being updated
body: <p><br>
  I've an issue with calling out JS variable in my HTML. It's simply not getting updated.<br>
  The following code is palced in the header:<br></p>
  
  <pre><code> &lt;script type="text/javascript"&gt;
  var sum = 0;
  function pushmybutton(id,value){
    sum += value;
    document.getElementById(id).disabled = true;
  };
  &lt;/script&gt;
  </code></pre>
  
  <p>There are a couple of questions within the body and they have the following format:<br></p>
  
  <pre><code>&lt;h6&gt;Question1&lt;/h6&gt;
  
  &lt;p&gt;Lorem Ipsum&lt;/p&gt;
  
  &lt;div class="button1"&gt;&lt;a href="#" id="B1A" onclick="pushmybutton('B1A',30);ga('send', 'event', 'Q1', 'Y');"&gt;Yes&lt;/a&gt;&lt;/div&gt;
  
  &lt;div class="button1"&gt;&lt;a href="#" id="B1B" onclick="pushmybutton('B1B',30);ga('send', 'event', 'Q1', 'N');"&gt;No&lt;/a&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>At the end I want to call out the variable sum, I use the following code for that:<br></p>
  
  <pre><code>    &lt;div class="result"&gt;
        Your result is:
        &lt;script&gt;
          document.write(sum);
        &lt;/script&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>Unfortunately, the variable sum is not being updated and it end up being equal to 0. However, if I use a button at the end with alert(sum) instead, it's being updated.</p>
  
  <pre><code>&lt;button onclick=alert(sum);&gt;Results&lt;/button&gt;
  </code></pre>
  
  <p>How can I fix it and write the updated variable into my HTML file.</p>