I have this script that is design to get the values in the targeted p tags which consist of numbers which I end up using as a addition situation the problem is the
answer is suppose to be 3 not 12 the script is treating the plus symbol as a concatenation situation so how can I make the script do addition in that situation with the the variable one and two?
Here is my code
var one= document.querySelector('#oneEx').innerHTML;
var two= document.querySelector('#twoEx').innerHTML;
var total= one+two;
document.write(total);
.mathDesign{
display: inline-block;
}
<p id='oneEx' class='mathDesign'>1</p>
<p class='mathDesign'>+</p>
<p id='twoEx' class='mathDesign'>2</p>
<p class='mathDesign'>=</p>