Retain Selected value in dropdown -Jquery
<p>I am trying to retain a selected value in the dropdown after posting the page.</p>

<p><strong>Description of scenario</strong></p>

<p>These are my dropdown options</p>

<pre><code>&lt;select id="JqueryDDownForAvailableFrom"&gt;
&lt;option value="17:00"&gt;17:00&lt;/option&gt;
&lt;option value="18:00"&gt;18:00&lt;/option&gt;
&lt;/select&gt;
</code></pre>

<p>Before submitting the Page, I am assigning the value to a variable using the below line.</p>

<pre><code>var selectedVal=$("#JqueryDDownForAvailableFrom")
</code></pre>

<p>After submitting the page the same dropdown should retail its value.</p>

<p>I do not want to change in options, but want to display the selected value after posting the form.</p>

<p><strong>I have used this one:</strong></p>

<p>This is adding anew option to the dropdown.</p>

<pre><code>$('#JqueryDDownForAvailableTo').append('&lt;option selected="true" value='+selectedValTo+'&gt;' +selectedValTo + '&lt;/option&gt;')
</code></pre>

<p><strong>I have used this one</strong></p>

<p>This is not selecting the selected value:</p>

<pre><code>  $('#JqueryDDownForAvailableTo').val(selectedValTo);
</code></pre>

<p>I tried to find on google but failed.</p>

<p>Any assistance please.</p>
