title: Onclick not repeating with button (variable maxes out at an integer of 1)
body: <p>I have the following javascript code, with the first two functions and the qty in the first variable towards the bottom being the most important here:</p>
  <pre><code>// show qty and price
  function add(qty) {
  qty++;
  document.getElementById(&quot;qty&quot;).innerHTML = (qty);
  }
  function remove(qty) {
  if (qty &gt; 0) {
  qty--;
  document.getElementById(&quot;qty&quot;).innerHTML = (qty);
  } else {
  document.getElementById(&quot;qty&quot;).innerHTML = (qty);
  }
  }
  // load products on home
  function bl() {
  document.getElementById(&quot;bl&quot;).style.display = &quot;initial&quot;;
  document.getElementById(&quot;br&quot;).style.display = &quot;none&quot;;
  }
  function br() {
  document.getElementById(&quot;br&quot;).style.display = &quot;initial&quot;;
  document.getElementById(&quot;bl&quot;).style.display = &quot;none&quot;;
  }
  // load cart
  function cart() {
  document.getElementById(&quot;cart&quot;).style.display=&quot;block&quot;;
  if (qty == 0) {
  document.getElementById(&quot;by&quot;).style.display=&quot;none&quot;;
  } else {
  document.getElementById(&quot;by&quot;).style.display=&quot;block&quot;;
  }
  }
  // leave cart
  function leavecart() {
  document.getElementById(&quot;cart&quot;).style.display=&quot;none&quot;;
  }
  // product list
  var flower = {
   blueyellow: { 
      color : &quot;linear-gradient(to right, blue, yellow)&quot;,
      src : &quot;https://cdn.pixabay.com/photo/2022/07/22/15/11/woman-7338352_1280.jpg&quot;,
      price : 30,
      qty : 0,
      size : &quot;small&quot;
    },
   redyellow: { 
      color : &quot;red, yellow&quot;,
      src : &quot;https://cdn.pixabay.com/photo/2022/05/22/16/50/outdoors-7213961_1280.jpg&quot;,
      price : 25,
      qty : 0,
      size : &quot;large&quot;
    }
  };
  // product list in cart
  document.getElementById(&quot;bycolor&quot;).style.display = (flower.blueyellow.color);
  document.getElementById(&quot;bysrc&quot;).src = (flower.blueyellow.src);
  document.getElementById(&quot;byprice&quot;).innerHTML = (&quot;$&quot; + flower.blueyellow.price);
  </code></pre>
  <p>Then I have two buttons: one to add to qty and one to remove from qty:</p>
  <pre><code>&lt;div id=&quot;wrap&quot; style=&quot;padding: 10px;&quot;&gt;
  &lt;h2&gt;Add to Cart&lt;/h2&gt;&lt;p id=&quot;qty&quot;&gt;&lt;/p&gt;&lt;button onclick=&quot;add(flower.blueyellow.qty)&quot;&gt;+&lt;/button&gt;&lt;button onclick=&quot;remove(flower.blueyellow.qty)&quot;&gt;-&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  <p>The problem here is that onclick only brings the qty to 1 and no further. I had it working before trying to adapt it to a variable within a variable, but now it stops.</p>