I am comparing two strings that supposed to be equal. From some reason it thinks they are not.
this is the code:
function(){
prev = $('h').value;
now = $('content').innerHTML;
alert(prev);
alert(now);
if(prev == now)
{
$('content').fade({ duration: 3.0, from: 0, to: 1 });
}
else{alert('lol');}
}
I made added the alert functions to be sure they are equal.
Any idea why it gives me the "alert('lol)" ?
Your strings are probably different, but it's hard to see leading and trailing whitespace in alert()
boxes. You can try to trim() the strings:
if ($.trim(prev) == $.trim(now)) {
$('content').fade({ duration: 3.0, from: 0, to: 1 });
}