Setting multiple value for select
<p>How can i set multiple values for multiple select. This is what i have tried so far in jquery. I looking for a jquery as well as pure js solution(just for my knowledge). </p>

<pre><code>for(x in gList)
{
    $('#GList').val(gList[x]);
}
</code></pre>

<p>This is selecting only one and not all.</p>

<p>EDIT: I found another solution in jquery . Hope this too helps others. In the loop use</p>

<pre><code>$("#GList option[value=" + gList[x] +"]").attr("selected","selected") ;
</code></pre>
