VOOZH about

URL: https://www.geeksforgeeks.org/jquery/how-to-disable-or-enable-form-submit-button-in-jquery/

⇱ How to disable or enable form submit button in jQuery? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to disable or enable form submit button in jQuery?

Last Updated : 23 Jul, 2025

Enabling or disabling the form submit button based on a checkbox selection in jQuery. This ensures user compliance with terms and conditions before form submission.

Syntax:

$('#enabled').click(function () {
if ($('#submit-button').is(':disabled')) {
$('#submit-button').removeAttr('disabled');
} else {
$('#submit-button').attr('disabled', 'disabled');
}
});

Example 1: The example shows jQuery to dynamically enable/disable the submit button based on the checkbox state, ensuring terms acceptance before submission. It structures HTML with a checkbox and submit button, complemented by CSS for styling.

Output:

👁 toggleexample
Output

Example 2: In this example the jQuery to dynamically enable or disable the submit button based on checkbox selection, ensuring terms acceptance before submission. It features styled UI elements, including a checkbox for agreement and a visually distinct submit button.

Output:

👁 toggle
Output
Comment

Explore