Today when i tried to change the value of hidden filed in java script, its not setting the value. I am using master page for an ASPX page.
<asp:HiddenField ID="hdnTest"
runat="server"
Value="Before JS
Call" />
In java script method, when I try to assign the value it’s not
getting replaced with new value.
document.getElementById('<%=hdnTest.ClientID%>').value = 'After JS Call';
document.getElementById('ContentPlaceHolder1_hdnTest').value = 'After JS Call';
and it worked out.
Not sure with the reason but its resolved!
1 Comments:
Instead for Doing like this. In Jquery You can simply get it. Like
$('#hdnValue').val("Some Text");
Post a Comment