While attempting to compare two strings using JavaScript, I encountered the following code:
var statuss = document.getElementById("status").innerHTML;
//alert(statuss);
var s =statuss.toString();
var ss= "Active";
if (s === "Active"){
alert ('match');
}
else {
alert ('do not match');
}
I am puzzled as to why I'm receiving the output "do not match" instead of 'match', especially when running the line:
alert('document.getElementById("status").innerHTML');
The output for this alert is: Active. In theory, both variables should match, so why am I getting the opposite result?