title: Get values from same class buttons
body: <p>I have a problem with this script.<br>
  I don't understand why Javascript doesn't recognize pdb[i].<br><br></p>
  <pre><code>let pbd=document.getElementsByClassName('pbda');
  
  for (var i=0;i&lt;pbd.length;i++) {
    pbd[i].addEventListener('click',function() {
      let xhttp=new XMLHttpRequest();
      xhttp.onreadystatechange=function() {
        if (this.readyState==4&amp;&amp;this.status==200) {
          document.getElementById('obxs').style.display='flex';
          document.getElementById('obxd').innerHTML=this.responseText;
        };
      };
      xhttp.open('POST','/ajax/orderdetails',true);
      xhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
      xhttp.send('oid='+pbd[i].value);
    })
  };
  </code></pre>
  <p><br>Error is -&gt; Uncaught TypeError: Cannot read property 'value' of undefined
  at HTMLButtonElement.<br></p>