title: Setting HTML text to a JS variable
body: <p>I want to take text from an html tag and save it in a js variable. What I am looking at is this:</p>
  
  <p>JavaScript:</p>
  
  <pre><code>function Myfunction(){
    var x; //Fist num here
    var y; //second num here
    var z=x+y;
    alert(z);
  }
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;p id="num1"&gt;2&lt;/p&gt;
  &lt;p id="num2"&gt;3&lt;/p&gt;
  </code></pre>
  
  <p>I am working on  a calculator and want to take the values from the "screen" and save them to a variable, to do math with. Each number is separated like this in the calc program:</p>
  
  <pre><code>&lt;samp id="numb1"&gt;Any Number&lt;/samp&gt;&lt;samp id="op"&gt;(+,-,*,/)&lt;/samp&gt;&lt;samp id="numb2"&gt;Any Number&lt;/samp&gt;&lt;samp id="answer"&gt;Answer prints here&lt;/samp&gt;
  </code></pre>
  
  <p>Once the answer is saved to a variable, the numb1, op, and numb2 are cleared and answer is printed.</p>