checked all items items in checkbox javascript

Solutions on MaxInterview for checked all items items in checkbox javascript by the best coders in the world

showing results for - "checked all items items in checkbox javascript"
Étienne
26 Sep 2019
1function toggle(source) {
2    var checkboxes = document.querySelectorAll('input[type="checkbox"]');
3    for (var i = 0; i < checkboxes.length; i++) {
4        if (checkboxes[i] != source)
5            checkboxes[i].checked = source.checked;
6    }
7}
Viktoria
30 Jun 2017
1  $( '#container .toggle-button' ).click( function () {
2    $( '#container input[type="checkbox"]' ).prop('checked', this.checked)
3  })
4