title: Jquery Hidden Field
body: <p>Why can't I get the value of this hidden field?</p>
  
  <p>I have a control...</p>
  
  <pre><code>&lt;asp:HiddenField ID="HiddenFieldServerDateTime" runat="server" /&gt;
  </code></pre>
  
  <p>Which renders as...</p>
  
  <pre><code>&lt;input type="hidden" name="ctl00$cph_main$HiddenFieldServerDateTime" id="ctl00_cph_main_HiddenFieldServerDateTime" value="08/01/2010 10:54:11" 
  </code></pre>
  
  <p>Which I'm trying to get the value of using...</p>
  
  <pre><code>var serverDateTime = $("#HiddenFieldServerDateTime").attr('value');
  </code></pre>
  
  <p>So what's wrong?</p>
  
  <p><strong>I prefer this</strong></p>
  
  <pre><code>var dateTime = $("[id$=_HiddenFieldServerDateTime]").val();
  </code></pre>