i want to send value (which is in my javascript) to an asp hiddenfield value so i can access the variable in code behind (C#).
so i have a hiddenfield:
<asp:HiddenField id="SendA" value="ee" runat="server" />
and in my javascript:
function test2() {
document.getElementById("<%=SendA.ClientID%>").value = "nice";
alert(document.getElementById("<%=SendA.ClientID%>").value);
}
but the console says: JavaScript.js:76 Uncaught TypeError: Cannot set properties of null (setting 'value') at test2.
i have the right syntax and it should alert nice , whats my problem?

Ensure that your JavaScript code is placed after the HiddenField in the rendered HTML or that it's executed after the DOM has fully loaded. I mean; you may need something like that: