Skip to main content
The CheckboxElement class aids in creating checkbox input elements in a user interface.

Constructor

NameTypeDescription
elementIdstringThis property in constructor accepts the Id for the element
labelstringThis property in constructor accepts the label for checkbox
optionsArray<OptionElement>This property in constructor accepts options for checkbox

Class Usage

Here’s how to create an instance of the CheckboxElement class:
In this example, a new instance of CheckboxElement is created with an elementId “1”, a label “Choose options”, and a list of two options.

Key Properties and Methods

Default Value of the Input Element

The setDefaultValue() method sets the default value(s) in the checkbox input, while the getDefaultValue() retrieves it. For example:

Example

Here is an example that showcases the creation and manipulation of an instance of CheckboxElement: