You can also use the below code to get all checked checkboxes values.
- <script>
- document.getElementById('btn').onclick = function()
- var markedCheckbox = document.querySelectorAll('input[type="checkbox"]:checked');
- for (var checkbox of markedCheckbox)
- document.body.append(checkbox.value + ' ');
- </script>