Checkbox Validation with jQuery

Require the terms checkbox before continuing. The client-side check improves usability; repeat the requirement on the server after form submission.

HTML Top ↑

<input type="checkbox" id="terms">
<label for="terms">I agree to the terms</label>

<button type="button" id="signup">
    Signup
</button>

<div id="status" aria-live="polite"></div>

jQuery Top ↑

$( "#signup" ).on( "click", function () {
    if ( !$( "#terms" ).prop( "checked" ) ) {
        $( "#status" ).text(
            "Please agree to the terms."
        );
        return;
    }

    $( "#status" ).text(
        "Client-side check passed."
    );
});

Checkbox tutorial · Form validation pillar · Radio buttons

Additional Original Learning Routes Top ↑

These original tutorial/demo routes are retained so no useful learner path is lost:






plus2net.com






✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer