SCEditor

insertText()

insertText(value) Since: 1.4.3

Inserts text into the editor at the position of the cursor.

If end is not null and there is some selected text, the selected text will be placed between the start and end strings.

If there is no selection and end is set, it will just be appended to the end of start before inserting.

Syntax

instance.insertText(start[, end]);

Parameters

start
Type: String

The text to insert

end
Type: String
Default: null

If not null and there is some text selected, the selected text will be placed between the start and end strings.

If there is no selected text, this will just be appended to the end of start.

Return

Type: sceditor

Example

Inserting text:

var textarea = ...;
sceditor.instance(textarea).insertText('Hello World!');