I have a very basic if statement and it reads like this:
var p1 = document.getElementById('p1').value;
var p2 = document.getElementById('p2').value;
if(p1==p2){
document.write("P1=P2");
} else {
document.write("P1 Does Not Equal P2")
};
Followed by the following HTML
<p id="p1">2</p>
<p id="p2">4</p>
I just want to be able to identify the if the value within p1
is greater or less than the value of p2
. Eventually this will have bigger consequences than just document.write
but at this time the if statement does not recognize the content in between the <p></p>
.