title: How Do I Pass ASP.NET Control Name to Javascript Function?
body: <p>I have Googled this to death and found lots of 'answers', but none of them will work for me, so maybe you clever people could give me a 'definitive' answer?</p>
  
  <p>I have a Javascript function:</p>
  
  <pre><code>function enableSaveLink() {
      document.getElementById('&lt;%= btnSaveLink.ClientID %&gt;').removeAttribute('disabled');
  }  
  </code></pre>
  
  <p>This works fine, but obviously it is hard-coded to  enable a particular control on my page.  What I'd like is to be able to call this function from any control on the page, passing the name of the control I'd like to enable as a variable.  So, in an ideal world, my Javascript function would look like this:</p>
  
  <pre><code>function enableControl(ctl) {
      document.getElementById(ctl).removeAttribute('disabled');
  }  
  </code></pre>
  
  <p>And I'd call it like this:</p>
  
  <pre><code>&lt;asp:button id="btnTestButton" runat="server" Text="Click Me" onclientclick="enableControl('txtTestTextbox') /&gt;
  &lt;asp:button id="txtTestTextbox" runat="server" enabled="false /&gt;
  </code></pre>
  
  <p>I know the way I've passed the control name would never work, but I've tried passing it in all different ways and none work, so this is just for the purposes of illustration.  Can anyone tell me how to actually make this work?</p>