Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] Comparing Strings


  • From: weirdit at gmail.com (Timothy White)
  • Subject: [Javascript] Comparing Strings
  • Date: Thu Aug 25 02:55:54 2005

I'm using some AJAX in an application I'm building. At the moment
until I do some more advanced work I just want to compare the AJAX
results I get with the contents of a div. And if they are different
the change the div contents so they are effectively the same.
The problem is that even when the results are the same, it still
thinks they are different.
So the following is always false when it should be true practically all the time

if (message_text == messages.innerHTML){

I know I must be missing something, they both are strings (according
to typeof) and I know the contents are the same cause the AJAX is
returning the same thing every time.
I've even put a test condition right after "message_text =
messages.innerHTML;" and it still says that they are not equal.

I must be missing something

This should be simple!!

Thanks

Tim
p.s. It needs to be cross browser as well, so I don't want a
Firefox/Mozilla or IE only solution