 <p>Correction, you're missing the <code>#</code>, and you're missing the <code>/</code> in <code>&lt;/li&gt;</code></p> <pre><code>for(var i=0; i&lt;test.length; i++) { $("#xyz" + i).html('&lt;li&gt;' + test[i] +'&lt;/li&gt;'); } </code></pre>