title: How to replace &nbsp; with whitespace in Javascript?
body: <p>I want to replace <code>'&amp;nbsp;'</code> in my code with simple whitespaces " ". These things aren't actually the same.</p>
  
  <p>How can I do this?</p>
  
  <p><a href="http://jsfiddle.net/Alexnotonfire/htg6qdxo/" rel="nofollow">JsFiddle</a></p>
  
  <p>This code won't work.</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;p&gt;No Space&lt;/p&gt;
  &lt;p&gt;&amp;nbsp;1 Space&lt;/p&gt;
      &lt;p&gt;&amp;nbsp;&amp;nbsp;2 Spaces&lt;/p&gt;
          &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;3 Spaces&lt;/p&gt;
              &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;4 Spaces&lt;/p&gt;
  </code></pre>
  
  <p><strong>JS</strong></p>
  
  <pre><code>$(document).ready(function() {
      $('p').each(function(){
        $(this).html($(this).html().replace(/&amp;nbsp;/gi," "));
      });
  });
  </code></pre>