title: Trying to add ids for anchor tag at the time of creating li tags
body: <p>I have the following JS Fiddle <a href="https://jsfiddle.net/73rpubfd/" rel="nofollow noreferrer">https://jsfiddle.net/73rpubfd/</a> working fine. Pasting the code here for reference:</p>
  <pre><code>&lt;ul class=&quot;nav nav-tabs&quot; id=&quot;test&quot;&gt;
  &lt;/ul&gt;
  
  var items=['a1','a2'];
  
  var arrayLength = items.length;
  
  for (var i = 0; i &lt; arrayLength; i++) {
     
     $(&quot;#test&quot;).append(&quot;&lt;li&gt;&lt;a&gt;&quot;+items[i]+&quot;&lt;/a&gt;&lt;/li&gt;&quot;);
      
  }
  </code></pre>
  <p>My requirement is to insert an id for the  tag and part of the id value will be coming from the the array values .</p>
  <p>So, I would expect it to be like this inside the loop :</p>
  <pre><code>$(&quot;#test&quot;).append(&quot;&lt;li&gt;&lt;a id=&quot;tab_&quot;+items[i]+&quot;&gt;&quot;+items[i]+&quot;&lt;/a&gt;&lt;/li&gt;&quot;);
  </code></pre>
  <p>And basically it would probably look something like this after inspecting the li element in the developer tools of chrome.</p>
  <pre><code>&lt;li&gt;&lt;a id=&quot;tab_a1&quot;&gt;a1&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a id =&quot;tab_a2&quot;&gt;a2&lt;/a&gt;&lt;/li&gt;
  </code></pre>
  <p>But as soon as I try to define `id = tab_&quot; it starts complaining. Am I doing something wrong?</p>