JavaScript - Simple Query
<p>Please see the <a href="http://jsfiddle.net/cEaeK/13/" rel="nofollow">JSFiddle</a> code I already have. My issue is that I require to use a radio check <strong>AND</strong> a text entry into a text field to enable other radios, checkboxes and text fields. So far I have only managed to enable radios, checkboxes and text fields using radio option 1 <strong>OR</strong> radio option 2.</p>

<p>This <a href="http://jsfiddle.net/cEaeK/13/" rel="nofollow">JSFiddle</a> might help you guys out and give you a greater understanding of what I mean.</p>

<p><strong>HTML:</strong> </p>

<pre><code> &lt;div class='conlabel'&gt;Have you started trading yet?&lt;/div&gt;
  &lt;table width="100"&gt;
          &lt;tr&gt;
            &lt;td&gt;&lt;label&gt;
              &lt;input type="radio" name="example" value="Yes" id="example_0" required /&gt;
              Yes&lt;/label&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;label&gt;
          &lt;input type="radio" name="example" value="No" id="example_1" required /&gt;
          No&lt;/label&gt;&lt;/td&gt;
      &lt;/tr&gt;
&lt;/table&gt;&lt;br&gt;
  &lt;li&gt;
      &lt;div class='conlabel'&gt;If Yes, enter trading name:&lt;/div&gt;
      &lt;input type="text" id="field1" name="field1" placeholder="" disabled /&gt;
  &lt;/li&gt;&lt;br&gt;
  &lt;li&gt;
  &lt;div class='conlabel'&gt;If No, then:&lt;/div&gt;
      &lt;input type="text" id="field2" name="field2" placeholder="" disabled /&gt;
  &lt;/li&gt;&lt;br&gt;

&lt;li&gt;
      &lt;div class='conlabel'&gt;Enter trading start date (enabled when started trading yet = yes + trading name = notnull:&lt;/div&gt;
      &lt;input type="text" id="field3" name="field3" placeholder="" disabled /&gt;
 &lt;/li&gt;&lt;br&gt;
</code></pre>

<p><strong>JS:</strong></p>

<pre><code>$(function(){
$("#example_0, #example_1").change(function(){
    $("#field1, #field2").val("").attr("disabled",true);
    if($("#example_0").is(":checked")){
        $("#field1").removeAttr("disabled");
        $("#field1").focus();
    }
    else if($("#example_1").is(":checked")){
        $("#field2").removeAttr("disabled");
        $("#field2").focus();   
    }
});
});
</code></pre>

<p>In this example the code currently enables and focuses on either field1 <strong>OR</strong> field2 depending on whether they section radio-example_0 or example_1. What I have not been able to figure out is if they select Yes (example_0) and then enter a trading name in field1 how then to enable field3.</p>

<p>Hope this is clearer than my last attempt. Thanks for your help! (:</p>

<p><strong>Answer:</strong> Kindly donated by <a href="http://stackoverflow.com/users/989452/daniel-v">Daniel V</a>.</p>

<pre><code>$(function(){
    $("#example_0, #example_1").change(function(){
        $("#field1, #field2").val("").attr("disabled",true);
            if($("#example_0").is(":checked")){
            $("#field1").removeAttr("disabled");
            $("#field1").focus();
        }
        else if($("#example_1").is(":checked")){
            $("#field2").removeAttr("disabled");
            $("#field2").focus();   
        }
    });
    });

$("#field1").blur(function(){
    if($("#example_0").is(":checked")){
             if($("#field1").val()!==""){
                   $("#field3").removeAttr("disabled");
            }
        }
    });
</code></pre>
