title: Selecting elements in a usercontrol using JavaScript
body: <p>I have a web form that contains a usercontrol and I would like to be able to access the html elements within the usercontrol from the form page using javascript.</p>
  
  <p>I tried the following:</p>
  
  <pre><code>document.getElementById('&lt;%= usercontrol.clientid %&gt;')
  </code></pre>
  
  <p>but this returned <code>null</code>. </p>
  
  <p>I had a look around with firebug and found that the tags in the usercontrol render with clientids like usercontrolid_myelement. I'm guessing that something like this might work:</p>
  
  <pre><code>document.getElementById('&lt;%= usercontrol.clientid %&gt;'+'_myelement')
  </code></pre>
  
  <p>Is there a better/nicer way of doing this? </p>