attach - Methods - Evaluation Options Editor API

Evaluation Options Editor API Methods

attach()

Attaches the editor UI instance to the provided DOM element.

You would want to use this method so that you can display the editor in a specific element on your page, such as a div or any other HTML element.

When the editor is created with the variant option set to "modal", this method renders the Evaluation options button in the element instead of the editor. Selecting the button opens the editor in a dialog.

Examples

// Display the editor inside the element with the id "editor"
await editor.attach(document.querySelector('#editor'));

Arguments

  • element object

    The DOM element (HTMLElement) to attach the editor to.

Return value

Type Promise

Resolves when the editor is attached.

Caveats

  • The returned promise rejects if you do not provide an element, or if the editor is already attached to an element. To attach the editor to a different element, call the detach() method first.
Was this article helpful?

Did you arrive here by accident? If so, learn more about Learnosity.