title: How to print value of button to input box onclick function?
body: <p>Here the button '1' is displaying value &quot;1&quot; in &lt;!p&gt; tag on clicking but the second button '2' is not displaying value &quot;2&quot; in the input box.Though both the functions are same.</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>//Working
  function one1() {
    onee = document.getElementById("b1").value;
    document.getElementById("ptag").innerHTML += "1";
  }
  //Not Working
  function one2() {
    twoo = document.getElementById("b2").value;
    document.getElementById("mydiv").innerHTML += "1";
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;input type="number" id="mydiv"&gt;&lt;br&gt;
  &lt;button id="b1" value="1" onclick="one1()"&gt;1&lt;/button&gt;
  &lt;button id="b2" value="2" onclick="one2()"&gt;2&lt;/button&gt;
  &lt;br&gt;
  &lt;p id="ptag"&gt;This is p tag&lt;/p&gt;</code></pre>
  </div>
  </div>
  </p>