title: Disable/Enable a text box based on radio/select option selected Javascript
body: <p>I am trying to disable an input field in HTML if a radio button has a particular value. I have used Javascript functions for the same. </p>
  
  <p>CODE SNIPPET 1 : (HTML RADIO BUTTON)</p>
  
  <pre><code>&lt;div class="element-radio"&gt;
      &lt;label class="title"&gt;Children&lt;/label&gt;
      &lt;div class="column column2"&gt;
          &lt;label&gt;
              &lt;input type="radio" name="children" value="Yes" onChange="findselected()"/&gt;
              &lt;span&gt;Yes&lt;/span&gt;
          &lt;/label&gt;
      &lt;/div&gt;
      &lt;span class="clearfix"&gt;&lt;/span&gt;
  
      &lt;div class="column column2"&gt;
          &lt;label&gt;
              &lt;input type="radio" name="children" value="No" checked="checked" onChange="findselected()"/&gt;
              &lt;span&gt;No&lt;/span&gt;
          &lt;/label&gt;
      &lt;/div&gt;
      &lt;span class="clearfix"&gt;&lt;/span&gt;
  &lt;/div&gt;
  
  &lt;div class="element-number"&gt;
      &lt;label class="title"&gt;No of children&lt;/label&gt;
      &lt;div class="item-cont"&gt;
          &lt;input class="large" type="text" min="0" max="100" name="no_children" placeholder="If YES, Number of Children?" value="&lt;?php echo $no_children?&gt;" /&gt;
          &lt;span class="icon-place"&gt;&lt;/span&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>CODE SNIPPET 2 : (JAVASCRIPT FUNCTION)</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function findselected() { 
     if (document.form.children.value == 'No') {
        document.form.no_children.disabled=true;
  //      return false;  // not sure this line is needed
     } else {
        document.form.no_children.disabled=false;
  //      return false;  // not sure this line is needed
     }
  } 
  &lt;/script&gt;
  </code></pre>
  
  <p>This does not work in the required way. Is there a better way to go about doing the same? I'm fairly new to Javascript so I wouldn't be able to implement a complicated code.</p>