title: jQuery shows that two same values are not same
body: <p>I am trying to do a chatbox with jQuery and php. Everything works, however i have one problem. I made such function for scrolling down</p>
  
  <pre><code>function scrolld() {
      $('#messages').scrollTop($('#messages')[0].scrollHeight);
  }
  </code></pre>
  
  <p>and it really works. Problem is when i am trying to use this function to scroll down and see latest messages. I am trying to use this function JUST when there is new messages, but it scrolls down every second... There is that function:</p>
  
  <pre><code>function update() {
      $.post("../../getinfo.php", { token:token2},
          function (result) {
                  $('.pirmas').text($('#messages').html()); //messages now
                  $('.antras').text(result);//messages from database
                  if($('.pirmas').text() != $('.antras').text())
                  { //when they are not equal (there is new message)
                      scrolld();
                  }
                  $('#messages').html(result);
          });
      window.setTimeout(update, 1000);
  }
  </code></pre>
  
  <p>How to make it scroll just when i have new messages? Because i tryed and saw that jquery shows that variables that are SAME are not equal (checked with php and they were equal) Can anyone help me? :) Thanks!</p>