Baze Validation

Example form with checkbox

Back to home

HTML

<form class="form-demo" id="demoCheckbox">
    <div class="form-row">
        <label>Email</label>
        <input type="email" required>
    </div>
    <div class="form-row">
        <label>Password</label>
        <input type="password" required>
    </div>
    <div class="form-row">
        <label>
            <input type="checkbox">
            <span>I agree with the terms and conditions</span>
        </label>
    </div>
    <button class="btn btn--primary">Submit</button>
</form>

JS

$('#demoCheckbox').bazeValidate({
    onValidated: function (e) {
        if ( !$('#dAgree').is(':checked') ) {
            e.preventDefault();
            alert('You have to check the checkbox');
        }
    }
});