Using ampersand in a javascript string
<p>I have this code:</p>

<pre><code>&lt;script&gt;
  var array = ["test1", "test2", "test &amp; test"];
  $(document).ready(function() {
      for (i = 0; i &lt; array.length; i++) {
          $("#" + array[i]).hide();
      }
  });
&lt;/script&gt;

&lt;ul&gt;
  &lt;li id="test1"&gt;&lt;/li&gt;
  &lt;li id="test2"&gt;&lt;/li&gt;
  &lt;li id="test &amp; test"&gt;&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>While using Javascript/JQuery I want to hide a few parts. 
However, the above code gives me a syntax error. </p>

<p>What do I do so I can compare the id from my listitem with the javascript string?
I already tried switching the ampersand in javascript with things like <code>"&amp;amp ;"</code> and <code>"&amp;#38 ;"</code></p>

<p>Since I get the id of the listitem from a database I'd prefer not to change that side.</p>