How to use a Javascript var as an ID for a div?
<p>What I have is a function that that generates string that get stored into a javascript var. What I want to do with that the var is assign it to be an id for a div on a page. I've been trying to get the variable set as the div ID but I have some difficulty in doing so.</p>

<pre><code>&lt;script&gt;
    var rand = "arandomstring"
&lt;/script&gt;
&lt;div id= $(rand)  class = "outline"&gt;
    &lt;b&gt;Some Sample Text&lt;/b&gt;&lt;br&gt;
&lt;/div&gt;
</code></pre>

<p>Am I assigning the variable correctly? It seems that this makes the div <code>id = "$(rand)"</code> rather than <code>"arandomstring"</code>.</p>

<p>Any help would be appreciated.</p>