title: How to show final result in a h2 tag with javascript
body: <p>I need a little help in JavaScript math.  I want to show the final result inside an h2 tag but I don't know how to do that (I am new to JavaScript). Please help and thanks in advance .</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Do Math&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;input type = "number" id = "my_input1"/&gt;
      &lt;input type = "number" id = "my_input2"/&gt;
      &lt;input type = "button" value = "Add them Together" onclick = "doMath();"/&gt;
      &lt;script type = "text/javascript"&gt;
          function doMath() {
              var my_input1 = document.getElementById('my_input1').value;
              var my_input2 = document.getElementById('my_input2').value;
              //Add them Together and Display
  
              var sum = parseFloat(my_input1) + parseFloat(my_input2);
              document.write("&lt;h2&gt;The sum is &lt;/h2&gt;", sum);
          }
      &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>