JQuery .val(value)
<p>Could anyone help me understand how this code segment works?  I'm assuming it produces something like <code>&lt;option value="val"&gt;text&lt;/option&gt;,</code> but I just don't see how it does that.</p>

<pre><code>$('&lt;option&gt;&lt;/option&gt;').val(val).html(text)
</code></pre>

<p>The above snippet is part the following code I used to add two options to a <code>&lt;select&gt;</code> statement.</p>

<pre><code>var myOptions = {val1:'text1', val2:'text2'};
$.each(myOptions, function(val, text)
{
   $('#mySelect').append($('&lt;option&gt;&lt;/option&gt;').val(val).html(text));
}
</code></pre>
