title: Why is foo & bar not returning true on comparison? (jQuery)
body: <p>I'm attempting to make a comparison. When a user first clicks the document name, that name should be stored as a variable. When the user adds or subtracts to the name, then something will happen. (Unless the name is returned to the original name; stored in the variable). </p>
  
  <p>The two variables don't appear to be equal, or I'm using the wrong comparison and I'm not sure how to achieve this. </p>
  
  <p>My Markup:</p>
  
  <pre><code>&lt;td class="document-name" contenteditable="true"&gt;&lt;?= str_replace('_',' ',$document-&gt;name); ?&gt; &lt;/td&gt;
  </code></pre>
  
  <p>My jQuery:</p>
  
  <pre><code>$(document).ready(function(){
        $('.document-name').keyup(function(){
          var bar=$(this).html().replace(/&amp;nbsp;/g,'');
          var foo=$(this).data("oldName");
          console.log("oldName is:" + foo);
          console.log("Bar is:" + bar);
          if(foo===bar){
            console.log("foo and bar are the same")
          }
        }).click(function(){
          $(this).data("oldName",$(this).html().replace(/&amp;nbsp;/g,''));
        });
      });
  </code></pre>