blockly > FieldDropdown > getText_

FieldDropdown.getText_() method

Use the getText_ developer hook to override the field's text representation. Get the selected option text. If the selected option is an image we return the image alt text. If the selected option is an HTMLElement, return the title, ariaLabel, or innerText of the element.

If you use HTMLElement options in Node.js and call this function, ensure that you are supplying an implementation of HTMLElement, such as through jsdom-global.

Signature:

protected getText_(): string | null;

Returns:

string | null

Selected option text.