I have a simple JQuery code where I'm trying to get the value of an ASP:HiddenField and display it, but it does not show anything.
The hidden field is in the form, not inside any table or div.
<asp:HiddenField ID="hdnID" runat="server" />
$(document).ready(function () {
$("#btnload").click(function () {
alert($("#hdnID").text());
});
});
I am setting the value of hidden field on page load and then when I click the button I want to display the value using alert. It shows an empty alert box every time.
What am I doing wrong?