[][src]Static p5_sys::global::createCheckbox

pub static createCheckbox: CreateCheckboxInternalType

Creates a checkbox input element in the DOM. Calling .checked() on a checkbox returns if it is checked or not

Examples

let checkbox;

function setup() {
  checkbox = createCheckbox('label', false);
  checkbox.changed(myCheckedEvent);
}

function myCheckedEvent() {
  if (this.checked()) {
    console.log('Checking!');
  } else {
    console.log('Unchecking!');
  }
}

Parameters

label? label displayed after checkbox

value? value of the checkbox; checked is true, unchecked is false