Checkboxes
Checkbox Helpers Javascript
Find helpful functions at your fingertips with this library file.
Methods
Init()
Adds event listeners to every select all checkboxes with class selectAllBox
. Also calls AssessChecks()
const checkboxes = new checkboxes4i();
checkboxes.Init();
AssessChecks()
Looks at groups of checkboxes with class checkboxOptions
and if all are checked, it checks the select all checkbox
checkboxes.AssessChecks();
Check()
Checks one or more checkboxes
const boxes = document.querySelectorAll(".yourClass");
checkboxes.Check(boxes);
Uncheck()
Unchecks one or more checkboxes
const boxes = document.querySelectorAll(".yourClass");
checkboxes.Uncheck(boxes);
GetPreferences()
Find all checkboxes that are checked and return the users preferences (esp)
const entireSectionWrapper = document.querySelector(".userSubscriptions");
const userPreferences = checkboxes.GetPreferences(entireSectionWrapper);
Notes
Select/unselect all checkbox:
has class selectAllBox
has unique ID allSales
Wrapper housing all checkbox options:
has class checkboxOptions
has unique ID: allSalesOptions
(FORMAT = selectAllBox
ID + "Options")
Resources
Sass File(s) | None |
---|---|
JS File(s) | /library/checkbox.js |
JS Functions | See Above |
Locale Keys | None |
Accessibility
None at this time.