title: &nbsp; not working with javascript if condition
body: <p>I am having javascript problem in my VF page so I am posting this question here.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;html&gt;
      &lt;input id="xyz" value="&amp;nbsp;"/&gt;
      &lt;script&gt;
          alert( document.getElementById('xyz').value);
          var x = document.getElementById('xyz').value;
          if(  x == '&amp;nbsp;' )
             alert(1)
          else
             alert(2);
      &lt;/script&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The input field xyz is having the value as <code>&amp;nbsp;</code> I am checking the  value in javascript but the if condition never evaluates to true. What could be the problem?  <a href="http://jsfiddle.net/mailtoshebin/NDBY3/" rel="nofollow">jsfiddle</a></p>