What input attribute do I use to make sure the user does not select everything in a list of html checkboxes? For example, I have created five checkboxes, but I want users to only select a maximum of three. I don't want to use radio buttons in this case. Please keep solutions to only HTML, not javascript.
Thanks. First newbie question here.
CodePudding user response:
HTML does not have any validation feature that makes that kind of check possible.
You need to use JavaScript to achieve this client-side.
You can use the setCustomValidity
method with your custom rules to generate an error message that uses the same style as the native HTML validation messages.