Using jQuery, how do I set the value of a hidden field and read it to confirm it was set correctly?
<p>In the function below, the code should take a parameter, </p>

<p>1) display an alert with the parameter value<br>
2) save the value to a hidden field<br>
3) display an alert with the value read from the hidden field. </p>

<p>Step 1 works. I can't confirm Step 2 is occuring and Step 3 returns 'undefined'.</p>

<p>The first alert shows the correct ID - the ID passed to SaveReportId().</p>

<p>The second alert shows "SaveReportId() after save: undefined"</p>

<pre><code>function SaveReportId(selectedReportId) {
    alert('SaveReportId() before save: ' + selectedReportId);
    $('#HiddenReportId').val(selectedReportId);
    alert('SaveReportId() after save: ' + $('#HiddenReportId').val());
}
</code></pre>

<p>HTML:</p>

<pre><code>&lt;div class="hiddenValues"&gt;
    &lt;input id="HiddenReportId" type="hidden" runat="server" class="HiddenReportId" /&gt;
&lt;/div&gt;
</code></pre>
