Click all check boxes at once with one check box (All agree button)

Currently, check boxes such as consent to the terms and conditions of use for membership are being used.

If you check the ‘All Agree’ check box at the top, you want to make sure that all the check box elements below are checked.

How can it be implemented?