How to disable submit button with jquery?
<p>I have a checkbox which needs to be checked in order for it to be possible to submit the form.</p>

<p>So I set the submit button disabled attribute to "disabled". Then I tried binding the checkbox to it like this so it would enable/disable the submit button. It does not work:</p>

<pre><code>$('input[type=checkbox]#confirm').click(function() {
    if ($(this).is(':checked')) {
        $('#submitButton').removeAttr('disabled');
    } else {
        $('#submitButton').attr('disabled', 'disabled');
    }
});
</code></pre>

<p>The submit button stays disabled.</p>

<p>HTML:</p>

<pre><code>&lt;form enctype="application/x-www-form-urlencoded" method="post" action="/controller/action"&gt;&lt;dl class="zend_form"&gt;
&lt;dd id="confirm-element"&gt;
&lt;input type="hidden" name="confirm" value="0"&gt;&lt;input type="checkbox" name="confirm" id="confirm" value="1" class="input-checkbox"&gt;&lt;/dd&gt;
&lt;dt id="confirm-label"&gt;&lt;label for="confirm" class="required"&gt;Lorem ipsum.&lt;/label&gt;&lt;/dt&gt;
&lt;dt id="submitButton-label"&gt;&amp;#160;&lt;/dt&gt;&lt;dd id="submitButton-element"&gt;
&lt;input type="submit" name="submitButton" id="submitButton" value="Potvrdiť" class="input-submit" disabled="disabled"&gt;&lt;/dd&gt;

&lt;input type="hidden" name="csrf_token" value="ed3e9347145a3eb3d58c4c21d813df26" id=""&gt;&lt;/dl&gt;&lt;/form&gt;
</code></pre>
