Grabbing asp.net controls in javascript
<p>I have a page where it is getting overwhelmed with code like:</p>

<pre><code>var textBox = $get("&lt;%=textState.ClientID%&gt;");
</code></pre>

<p>This requires me to have my JavaScript inside the page instead of nicely tucked in a js file. <strong>Is there a better approach to this?</strong></p>

<p>document.getElementById doesn't work because then I end up with code like this:</p>

<pre><code>var textBox = document.getElementById("originDestinationControl_textState");
</code></pre>

<p>or</p>

<pre><code>var textBox = document.getElementById("ctl00_ContentPlaceHolder_originDestinationControl_textState");
</code></pre>

<p>depending on where I am referencing these controls (inside master pages and/or usercontrols)</p>
