title: Ampersand in innerHtml() not being read correctly and validating in JS
body: <p>I just realized I screwed up the original HTML - the icon classes should not have been originally on the code.  Now I understand the downvoting - along with the general sloppiness of the javascript. I've modified the HTML, making it what it should have been to start with.</p>
  
  <p>I've got an unordered list that I'm searching through with jQuery to add a class to its anchor tag, depending on the text/innerHtml of the link that is in the list item:</p>
  
  <pre><code>&lt;ul class="menu-items"&gt;
  &lt;li class="menu-item icon-globe"&gt;
      &lt;a href="/test/Mobile/Accounts.aspx" class="ui-link"&gt;Accounts&lt;/a&gt;&lt;/li&gt;
  &lt;li class="menu-item icon-globe"&gt;
      &lt;a href="/dupont/Mobile/Transfers.aspx" class="ui-link"&gt;Transfers&lt;/a&gt;&lt;/li&gt;
  &lt;li class="menu-item emailMenuItem icon-globe"&gt;
      &lt;a href="/test/Mobile/Messages.aspx" class="ui-link"&gt;Messages&lt;/a&gt;&lt;/li&gt;
  &lt;li class="menu-item"&gt;
      &lt;a href="/test/CustomerService.aspx" class="ui-link"&gt;Alerts &amp;amp; Settings&lt;/a&gt;&lt;/li&gt;
  &lt;li class="menu-item emailMenuItem icon-globe"&gt;&lt;a href="/test/Mobile/DepositCheck.aspx" class="ui-link"&gt;Deposit a Check&lt;/a&gt;
  </code></pre>
  
  <p></li>
  </p>
  
  <p>Her is the jQuery statement that should be adding the "AlertSettingIcon" class to the Alerts &amp; Settings anchor tag:</p>
  
  <pre><code>$("li.menu-item a.ui-link").each(function() {
      if ($( this ).innerHtml == "Accounts") {
          $(this).addClass("AccountIcon");
      } else
          if ($( this ).innerHtml == "Transfers") {
              $(this).addClass("TransferIcon");
          } else
              if ($( this ).innerHtml == "Messages") {
                  $(this).addClass("MessageIcon");
              } else
                  if ($( this ).innerHtml == "Alerts &amp;amp; Settings") { 
                      $(this).addClass("AlertSettingIcon");
                  } else
                      if ($( this ).innerHtml() == "Deposit a Check") {
                          $(this).addClass("RDCIcon");
                      }
                      else {
                          $(this).addClass("AlertSettingIcon");
                      }
  
  });
  </code></pre>
  
  <p>When I use developer tools to examine the classes assigned to each anchor tag, the class does not get added.  I've tried using .text(), wrapping my script in CDATA tags, .html(), using /u0026, and a couple of other methods, but I have yet to successfully add the class to the "Alerts &amp; Settings" anchor element.  I've also done each of these methods in both firefox and Chrome to ensure it's not browser compatibility.</p>
  
  <p>Finally, here's a JSFiddle where the issue shows itself: <a href="https://jsfiddle.net/r7vnft5c/" rel="nofollow">https://jsfiddle.net/r7vnft5c/</a></p>
  
  <p>Can anyone figure out why the AlertSettingIcon class is not being added as the JS/jQuery is written, and what I can do to fix it?</p>
  
  <p>Thanks for your ideas,
  David</p>