title: How can I get the value of a sibling input element?
body: <p>What I'm trying to do here is simply update my cart for my e-commerce website. To do so I need to confirm the quantity of the product with my &quot;check button&quot;. So far I've managed to go over through all elements &quot;check buttons&quot;, however now I'm troubled with accessing the input's value.</p>
  <p><img src="https://i.stack.imgur.com/lviRj.png" alt="enter image description here" /></p>
  <pre><code>&lt;div class=&quot;plus-minus-input&quot;&gt;
          &lt;span class=&quot;minus&quot; data-action=&quot;remove&quot; data-pack={{ item.product.pack }}&gt;&amp;#8722;&lt;/span&gt;
          &lt;input class=&quot;quantity&quot; type=&quot;number&quot; id=&quot;{{item.product.id}}&quot; value=&quot;{{item.quantity}}&quot;/&gt;
          &lt;span class=&quot;plus&quot; data-action=&quot;add&quot; data-pack={{ item.product.pack }}&gt;&amp;#43;&lt;/span&gt;
          &lt;span class=&quot;update-cart check&quot; id=&quot;{{item.product.id}}&quot;&gt;&amp;#10004;&lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  <p>...</p>
  <pre><code>checkBtns = document.getElementsByClassName(&quot;update-cart&quot;);
  
      for (var i = 0; i &lt; checkBtns.length; i++){
          checkBtns[i].addEventListener(&quot;click&quot;, function(e) {
              var productId = $(this).attr(&quot;data-productId&quot;);
              var action = $(this).attr(&quot;data-action&quot;);
  
              var parentDiv = $(this).parentNode;
              var inputVal = parseInt(parentDiv.childNodes[1].dataset.value);
              var pack = parseInt(this.dataset.pack);
  ...
  
  
  
  </code></pre>