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