Availability: >= 2.0

Type: Object Method

Description: Overwrites the current selection with arbitrary HTML code.

If there is nothing selected or the editor has not yet received focus the string will be inserted at the top of the document.

To wrap the current selection in an HTML tag see applyStyle.


The following example will insert code into the editor named 'myEditor':

WPro.editors['myEditor'].insertAtSelection ('The code I want to insert');

This example will insert an image tag:

WPro.editors['myEditor'].insertAtSelection (' ');

This will wrap the current selection in a tag:

WPro.editors['myEditor'].insertAtSelection (''+WPro.editors['myEditor'].getSelectedHTML()+'');