enabling - disabling form elements checking - unchecking checkbox input jquery
<p>I want to enable all form elements when checking a checkbox form element. And reverse.<br>
This is my code (which doesn't work):    </p>

<pre><code>$(document).ready(function(){

    $('#coments input[type=text]').attr('disabled', 'disabled');
    $('#coments textarea').attr('disabled', 'disabled');
    $('#coments select').attr('disabled', 'disabled');
    $('#coments input[type=submit]').hide();

    $('#coments input[type:checkbox]').click(function() {
        var checkbox = $(this);

        if (checkbox.is(':checked')) {
            $('#coments input[type=submit]').show();
            $('#coments textarea').removeAttr('disabled');
            $('#coments select').removeAttr('disabled');
            $('#coments input[type=text]').removeAttr('disabled');
        } else {
            $('#coments input[type=text]').attr('disabled', 'disabled');
            $('#coments textarea').attr('disabled', 'disabled');
            $('#coments select').attr('disabled', 'disabled');
            $('#coments input[type=submit]').hide();
        }
    });
});
</code></pre>

<p>Hope any of you can help!</p>
