Reference createCheckbox()

createCheckbox()

Creates a checkbox <input> element.

Checkboxes extend the p5.Element class with a checked() method. Calling myBox.checked() returns true if it the box is checked and false if not.

The first parameter, label, is optional. It's a string that sets the label to display next to the checkbox.

The second parameter, value, is also optional. It's a boolean that sets the checkbox's value.

Examples

Syntax

createCheckbox([label], [value])

Parameters

label
String:

label displayed after the checkbox.

value
Boolean:

value of the checkbox. Checked is true and unchecked is false.

Returns

p5.Element: new p5.Element object.
This page is generated from the comments in src/dom/dom.js . Please feel free to edit it and submit a pull request!

Related References