Dropdown and datetime field working together
<p>I have one last jQuery question for the day. I have two fields. One is a dropdown and the other is a datetime field. If the user selects No then then it needs to disable the input field and removes any value inside the datetime field or if the user selects Yes then it adds class a validation rule to the datetime field.</p>

<pre><code>&lt;div class="section _100"&gt;
    &lt;label for="comments"&gt;Allow Comments&lt;/label&gt;
    &lt;div&gt;
        &lt;select name="comments" id="comments"&gt;
            &lt;option value="" selected="selected"&gt;Please Select An Option&lt;/option&gt;
            &lt;option value="0"&gt;No&lt;/option&gt;
            &lt;option value="1"&gt;Yes&lt;/option&gt;
        &lt;/select&gt;                           
    &lt;/div&gt;
&lt;/div&gt;

&lt;div class="section _100"&gt;
    &lt;label for="datetime"&gt;Date Comments Expire&lt;/label&gt;
    &lt;div&gt;
        &lt;input id="datetime" type="datetime" name="datetime" /&gt;
    &lt;/div&gt;
&lt;/div&gt;

$('#comments').change(function(){
    $('#datetime').removeAttr('disabled');
    $('#comments').not(this).val(0);
    $('#comments').each(function(){
        if($(this).val().length &gt; 0){
            $('#datetime').attr('value','');
        }
    });
});
</code></pre>
