How to Validate Checkbox in JavaScript

Hongtao Hao / 2021-06-01


I saw the question by TheLettuceMaster here . It’s a very good question. The solution by PleaseStand works like a charm. But there is a much simpler way, as indicated by PrestaShark : adding required anywhere in the <input />.

If the checkbox is unchecked, the browser will say “Please check this box if you want to proceed.”

This method, i.e., form validation, is supported by all modern browsers , as mentioned by charliepark .

Last modified on 2021-10-05