Function checkbox

Quick access to value. Provide a checkbox by string id or object reference. If a callback is supplied, it will be called when the checkbox changes value.

const opt = checkbox(`#chkMate`);
opt.checked; // Gets/sets

const opt = checkbox(document.getElementById(`#chkMate`), newVal => {
if (newVal) ...
});
  • Parameters

    • domIdOrEl: string | HTMLInputElement
    • OptionalonChanged: ((currentValue: boolean) => void)
        • (currentValue): void
        • Parameters

          • currentValue: boolean

          Returns void

    Returns {
        checked: boolean;
    }

    • get checked(): boolean
    • set checked(value: boolean): void