Textbox.io 2.x Documentation : Creating and Removing Editors

The textboxio JavaScript global enables you to create, modify and interact with instances of the editor. This is the starting point for any integration. This global is available immediately after the editor's JavaScript file has been loaded on the page.

The replace and editor.restore methods are the two most important methods in the API. They enable editor instances to be created and removed.

Creating Editors

The replace method is used to create a Textbox.io editor. The method takes a CSS3 selector as an argument, which identifies a target element on the page, and then replaces it with an editor. This target element must be either a <div> or <textarea>  element. The target element's contents are automatically loaded into the new Textbox.io editor. 

This method returns an instance of textboxio.editor. See Textbox.io API Reference for more information on using textboxio.editor

Create customized instances of Textbox.io by providing an editor configuration as a second argument. See the Customizing the Editor Developer Guide for more information.

Form Handling / Editor Contents

When used in conjunction with a <textarea> in an HTML <form> the content contained within Textbox.io will be submitted as part of the form's POST operation.

To retrieve the editor contents using JavaScript see Setting and Getting Content.

Restoring the source element (Removing the editor)

The editor.restore method enables you to remove Textbox.io instances from the page, restoring the original target element.  When called, editor.restore updates the target element's HTML content to match the HTML content of the Textbox.io editor.