title: how to work with javascript function for asp.net checkbox control which is placed in contentplaceholder?
body: <p>I have checkbox and textbox control from asp.net on the contentplaceholder. I want to call the javascript function for enabling the textbox control depending on the checked status of the checkbox. I have written following javascript for this-</p>
  
  <p>name of the <code>checkbox &amp; textbox</code> respectively after rendering it to browser <code>ctl00$ContentPlaceHolder1$chkCall, ctl00$ContentPlaceHolder1$txtCall</code></p>
  
  <pre><code>function chkChanged() {
             try {
  
             var echk = document.getElementsByName('ctl00$ContentPlaceHolder1$chkCall');
             var etxt = document.getElementsByName('ctl00$ContentPlaceHolder1$txtCall');
  
             if (echk.Checked) {
  
                 etxt.Enabled = true;
             }
             else {
                 etxt.Enabled = false;
                 etxt.Text = "";
             }
             return true;
             }
         catch (err) {
             alert(err.Message);
             return false;
         }
         }
  </code></pre>
  
  <p>When i'm executing above script then it calls function but the code is not working for the control. And it is not throwing any exception.</p>
  
  <p>What is wrong in above script? </p>
  
  <p>thanks.</p>