title: Javascript getElementById can't see ASP server controls
body: <p>I'm trying to get an old ASP classic project up and running as an ASP.NET webfroms solution and I'm having problems getting the javascript to connect to the ASP controls.  Here is the .aspx code:</p>
  
  <pre><code>&lt;asp:TextBox id="groupOwner2" CssClass="textbox" Runat="server" Enabled="False" TextMode="SingleLine"&gt;&lt;/asp:TextBox&gt;
  </code></pre>
  
  <p>And the javascript that is supposed to manipulate it looks like this, and is trying to clear the text box:</p>
  
  <pre><code>function OnChange() {
  // clear existing data
  
  document.getElementById('&lt;%=groupOwner2.ClientID%&gt;').value = "";}
  </code></pre>
  
  <p>Originally, the the javascript control reference looked like this:</p>
  
  <pre><code>document.Form1.elements["groupOwner2"]
  </code></pre>
  
  <p>and that didn't work either (unsurprisingly).   I've tried a number of variations on these but nothing has worked and I just get "JavaScript runtime error: Unable to set property 'value' of undefined or null reference" when the script is triggered.  For the record, the script is being triggered by another control which is why the onChange() function is not mentioned in the textbox ASP code.</p>
  
  <p>Any input would be appreciated!</p>