JQuery Validation - custom rule
<p>I have a simple form</p>

<pre><code>&lt;form role="form" id="my_form" class="form-horizontal"&gt;
    &lt;label class="radio"&gt;
        &lt;input type="radio" name="reason[]" id="reasonOne" value="1"&gt; Something
    &lt;/label&gt;
    &lt;label class="radio"&gt;
        &lt;input type="radio" name="reason[]" id="reasonTwo" value="2"&gt; Something else
    &lt;/label&gt;
    &lt;label class="radio"&gt;
        &lt;input type="radio" name="reason[]" id="reasonThree" value="Other"&gt; Other 
    &lt;/label&gt;
    &lt;input type="text" name="reason[]" placeholder="Please specify" id="other" class="form-control"&gt;
&lt;/form&gt;
</code></pre>

<p>The bottom radio controls a text input.  Initially this is hidden, and I do</p>

<pre><code>$('input:radio[name="reason[]"]').change(
    function(){
        if ($(this).is(':checked') &amp;&amp; $(this).val() == 'Other') {
            $('#other').css("display", 'block');
        } else {
            $('#other').css("display", 'none');
        }
    }
);
</code></pre>

<p>Defining rules for radio buttons is straight forward, I just need to make sure one is selected.  I am having a few issues with a custom rule.  Essentially, if reasonThree is selected, I need to make sure they enter something into the text input which is at this point displayed.
At this moment, I am trying something like the following.</p>

<pre><code>jQuery.validator.addMethod('customrule', function() {
    if($("input[id='reasonFive']:checked")) {
        if(('#other').val().length == 0) {
            return false;
        } else {
            return true;
        }
    }
    return false;
}, 'Please input a reason' );

var validator = $("#my_form").validate({
    rules: {
        'reason[]': {
            required: true,
            customRule: true
        }
    },
    messages: {
        'reason[]': {
            required: jQuery.validator.format("Please select an option")
        }
    }
});
</code></pre>

<p>If they select the last radio button, how can I make sure they enter something into the text area?</p>

<p>Thanks</p>