The requested page is not available for the requested platform. You are viewing the content for Default platform.

RichEditCommands.insertHtml Property

Gets a command to add an HTML formatted content in place of a selected range.


readonly insertHtml: InsertHtmlCommand

Property Value

Type Description

A InsertHtmlCommand object that provides methods for executing the command and checking its state.


You can invoke this command by calling the execute method.

The execute method checks the command state (obtained using the getState method) before executing, and decides whether the action can be performed. The execute and getState methods are members of the InsertHtmlCommand class.

Usage example:

richEdit.commands.insertHtml.execute("<table border="2"><tr><td>Text</td></tr></table>")

Supported tags

The following table lists which HTML tags are supported by the insertHtml command.

Tag Attribute Interpretation
A href Specifies the URL of the page a hyperlink goes to
title Specifies the title of a hypelink which appears to users as a tooltip
B Bold text
Br Line feed
Div A separate section of the document that groups elements
I Italic text
Img src Location of inline image (URI)
height Image height
width Image width
Li Defines the list item
Ol Defines an ordered list
P Defines a paragraph
Span Combined with the style sheet, specifies formatting of the text within the tag
Table Defines a table
Table bgcolor Specifies shading
Table border Specifies border width
Table borderSpacing Specifies border spacing
Table marginLeft Specifies the table's left margin
Table width Specifies table width
TD Defines a table cell
TD bgcolor Specifies shading
TD border Specifies border width
TD colspan Specifies the number of columns a cell should span
TD rowspan Specifies the number of rows a cell should span
TD valign Specifies vertical alignment for cell contents
TD width Specifies the width of a cell
TH Defines a table cell with bold text and center aligned contents
TH (any allowed) The same as for the <TD> tag
TR Defines a row in a table
TT Teletype text
Ul Defines bulleted list

The fontStyle, textTransform, textDecoration, color, backgroundColor, fontFamily, fontSize, display, and verticalAlign attributes are interpreted for all supported tags.

Note that the command does not support the style tag and CSS attributes.

See Also