title: how to access more than one text box which is in onchange Javascript
body: <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;script type="text/javascript" src="datetimepicker_css.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript"&gt;
              function sel(){
                  var y=document.getElementById("demo1").value;
                  document.getElementById("cal").innerHTML=y;
              }
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;?php 
          for($i=0; $i&lt;2; $i++){
      ?&gt; 
      &lt;input type="text" name="doi" required="" placeholder="current inspect date" id="demo1" onchange="sel()" required&gt;
      &lt;a href="javascript:NewCssCal('demo1','ddmmmyyyy','arrow')"&gt;&lt;img src="cal.gif" alt="failed to load img"&gt;&lt;/a&gt;
  
      &lt;?php
      }
      ?&gt;
      &lt;p id="cal"&gt;&lt;/p&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>(<a href="https://i.stack.imgur.com/e3oZ3.png" rel="nofollow noreferrer">datetimepicker_css.js is my calender file used to select date</a>); two textbox id=demo[after select of calender it print correct when i select other calender first text is affected. I need to access two text value after selecting each calender.</p>
  
  <p><a href="https://i.stack.imgur.com/e3oZ3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/e3oZ3.png" alt="enter image description here"></a></p>