Check out my code example on jsfiddle: https://jsfiddle.net/elenderg/wzarrg06/63/
In the first div, there are 10 buttons. See image below: https://i.sstatic.net/BDdtG.png
<button class='btn btn-info custom' onclick="myFunction()">6 (R$ 2,00)</button>
<button class='btn btn-info custom' onclick="myFunction()">7 (R$ 5,00)</button>
<button class='btn btn-info custom' onclick="myFunction()">8 (R$ 10,00)</button>
<button class='btn btn-info custom' onclick="myFunction()">9 (R$ 20,00)</button>
<button class='btn btn-info custom' onclick="myFunction()">10 (R$ 50,00)</button>
<button class='btn btn-info custom' onclick="myFunction()">11 (R$ 100,00)</button>
<button class='btn btn-info custom' onclick="myFunction()">12 (R$ 250,00)</button>
<button class='btn btn-info custom' onclick="myFunction()">13 (R$ 500,00)</button>
<button class='btn btn-info custom' onclick="myFunction()">14 (R$ 1000,00)</button>
<button class='btn btn-info custom' onclick="myFunction()">15 (R$ 2000,00)</button>
By clicking on one of these buttons, users will be restricted to select a specific number of checkboxes in div #2 For instance, if they click on the "6" button, they can only check up to 6 checkboxes. https://i.sstatic.net/tUYsd.png
I'm looking for a JavaScript or jQuery solution to enforce this limitation on checkbox selection based on the button clicked.