JSFiddle - React, Tailwind, and code Playground

by charlescarver

HTML

<form action="javascript:alert( 'success!' );">
    <div>1:
        <input type="checkbox" />
        <br />2:
        <input type="checkbox" />
        <br />
        <input type="submit" />
    </div>
</form>

JavaScript

$("form").submit(function () {
    var length = $('input[type=checkbox]').not(':checked').length;
    if (length > 1) {
        alert("Please select at least one to upgrade.");
        return false;
    }
});