JavaScript check all checkboxes from querySelectorAll result

Use querySelectorAll with forEach to check checkboxes.

document.querySelectorAll('[type=checkbox]').forEach((checkbox) => {
checkbox.checked = true;
});
If you liked this posting, please feel free to leave me a comment below.
View this page on GitHub.
Posted .

Comments

Leave a Reply