JQuery-Set value for empty dropdown from a variable
<p>I have a dropdown box, It has no values in them. I have to set it preselected with a value available in a variable. This is what I have done but it does not set this value.</p>

<pre><code>if(condition)
{
    var selectedVal = "myValue";                
    $("#myDropDownId").val(selectedVal);
}
</code></pre>

<p>as per info from google, the above one works when there are options already available in the dropdown.</p>

<p>I tried with the below as well</p>

<pre><code>if(condition)
{
    var selectedVal = "myValue";                
    $("#myDropDownId option:selected").val(selectedVal);
 }  
</code></pre>

<p>What is the correct syntax for this please?  </p>
