Value Of Control Assigned With Javascript
<p>Why when I assign new value of HiddenField control with javascript, the value of HiddenField control in this case remains the same state (5) when I call it with "&lt;%= this.HiddenField.Value %>" ? But when I call it with "console.log(document.getElementById('&lt;%= this.HiddenField.ClientID %>').value);" this return the chagned state in this case "active", why? How I can get the changed value in code behind (I want "&lt;%= this.HiddenField.Value %>" to return "active"(the changed value)) ?</p>

<pre><code>&lt;script&gt;
    $(function () {
        document.getElementById('&lt;%= this.HiddenField.ClientID %&gt;').value = "active";
        console.log(document.getElementById('&lt;%= this.HiddenField.ClientID %&gt;').value); // this return te changed value "active"
        console.log('&lt;%= this.HiddenField.Value %&gt;') //this again is 5 not "active"
    });
&lt;/script&gt;
&lt;asp:HiddenField ID="HiddenField" runat="server" Value="5" /&gt;
</code></pre>
