Skip to main content

isSelected()

checks whether a toggle of the ToggleGroup control is selected

isSelected(id?: string): boolean | { [id: string]: boolean };

Parameters:

  • id: string - optional, the id of a toggle

Returns:

Either a boolean value or an object.

If the id of a toggle is specified, the method returns a boolean value true, if the toggle is selected; otherwise, false.

If the id of a toggle is not specified, the method returns an object with a set of key:value pairs where the key is the id of a toggle and the value is the state of the toggle.

Example

form.getItem("ToggleGroup").isSelected("toggle_1"); 
// -> true/false

form.getItem("ToggleGroup").isSelected();
// -> { "toggle_1": true, "toggle_2": false }