title: JavaScript run if else statement again after value change
body: <p>new to JavaScript so please bear with me! I'm stuck in a research rut and not sure on the best way forward with this one</p>
  <p>I'm attempting to put together the statement below, but not sure about how to best have the script run again/re-check the if else statement once the <code>TotalPrice</code> value updates.</p>
  <p>The <code>TotalPrice</code> dynamic value is within <code>&lt;span class=&quot;money&quot;&gt;&lt;/span&gt;</code> and increases/decreases based on user input (<code>quantityDown</code> &amp; <code>quantityUp</code> +/- DIVs)</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var TotalPrice = 0;
  
  if (TotalPrice == 0) {
    document.write('&lt;div&gt;PRICE IS 0&lt;/div&gt;');
  } else {
    document.write('&lt;div&gt;PRICE IS NOT 0&lt;/div&gt;');
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="quantityDown_0_0" class="quantity-down" mindx="0_0" vindex="0" onclick="quantityDown(this)"&gt;&lt;/div&gt;
  
  &lt;div id="quantityUp_0_0" class="quantity-up" mindx="0_0" vindex="0" onclick="quantityUp(this)"&gt;&lt;/div&gt;
  
  &lt;span class="money"&gt;£0&lt;/span&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>The basic code above is working correctly on the initial page load (producing <code>&lt;div&gt;PRICE IS 0&lt;/div&gt;)</code>, but once the <code>&lt;span class=&quot;money&quot;&gt;£0&lt;/span&gt;</code> value changes, the else statement is not running</p>
  <p><strong>Where I'm at so far...</strong></p>
  <ul>
  <li>Am I right in thinking/on the correct path that I need to setup an event listener that
  checks for any changes on the <code>&lt;span class=&quot;money&quot;&gt;&lt;/span&gt;</code>? That'll
  re-run the JavaScript when/if its value changes?</li>
  </ul>
  <p>I appreciate this is fairly basic JavaScript, so any advice on how to apply this for a learner would be massively appreciated!</p>