#102770
Yavor Dashev
Participant

Hi Mario,

 

I have created a quick JavaScript code snippet to showcase how to achieve the functionality that you need and store the value of the checked checkbox.

    <smart-check-box value="1">Check Box</smart-check-box>
    <smart-check-box value="1">Check Box</smart-check-box>
    <smart-check-box value="17-333123">Check Box</smart-check-box>
    <smart-check-box value="17-22">Check Box</smart-check-box>
    <smart-check-box value="17-321">Check Box</smart-check-box>
    <smart-check-box value="17-123">Check Box</smart-check-box>
    <smart-check-box value="17-111">Check Box</smart-check-box>
    <smart-check-box value="17-333331">Check Box</smart-check-box>
    <smart-check-box value="17-22">Check Box</smart-check-box>
    <smart-check-box value="17333">Check Box</smart-check-box>
    <smart-check-box value="17-4PH1111">Check Box</smart-check-box>
    <smart-check-box value="17-4PH2">Check Box</smart-check-box>
    <smart-check-box value="17-4PH1">Check Box</smart-check-box>
    <smart-check-box value="17-4PH123">Check Box</smart-check-box>

	<!-- scripts -->  
    <script type="module" src="../../../source/modules/smart.checkbox.js"></script> 
    <script >
        window.onload = function () {
            const allCheckBoxes = document.querySelectorAll("smart-check-box");
            let checkedBoxesValues= []

            Array.from(allCheckBoxes).forEach(checkBox => {
                checkBox.addEventListener('change', ()=> {
                    checkedBoxesValues.push(checkBox.value)
                    console.log(checkedBoxesValues)
                })
            })
        };
    </script>	

Let me know what you think!

Please, do not hesitate to contact us if you have any additional questions.

Best regards,
Yavor Dashev

Smart UI Team
https://www.htmlelements.com/

 

  • This reply was modified 2 years, 5 months ago by Yavor Dashev.
  • This reply was modified 2 years, 5 months ago by Yavor Dashev.