title: Accessing value of hidden variable in Javascript wiht VB
body: <p>I tried the following code but did not succeed.It would be great if you could guide me. I was trying to test using a simple "Hello". In the actual program I would assign a string value to the hidden field.</p>
  
  <p>I get an Alert box ( using this to test whether the value is accessible in javascript ) but with no values.</p>
  
  <p><strong>Server Side</strong></p>
  
  <pre><code>ivar.Value = "Hello"
  </code></pre>
  
  <p><strong>Javascript</strong></p>
  
  <pre><code>&lt;script&gt;
      function getval() {
          var v = document.getElementById('&lt;%= ivar.ClientID%&gt;').value;
          alert(v)
      }
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>Form</strong></p>
  
  <pre><code>&lt;asp:Button ID="Button1" runat="server" Text="CALCULATE" onclientclick="getval()" /&gt;
  &lt;asp:HiddenField ClientIDMode="static" id="ivar" runat="server" Value=""/&gt;  
  </code></pre>