HTML DOM execCommand() Method
Definition and Usage
The execCommand()
method executes the specified command for the selected part of an editable section.
Browser Support
The numbers in the table specifies the first browser version that fully supports the method.
Method | |||||
---|---|---|---|---|---|
execCommand() | Yes | 9.0 | 41.0 | 20.0 | 29.0 |
Note: This is an experimental technology, and will probably change before the final release.
Syntax
document.execCommand(command, showUI, value)
Parameter Values
Value | Description |
---|---|
command |
Specifies the name of the command to execute on the selected section.
Legal values: "backColor" "bold" "createLink" "copy" "cut" "defaultParagraphSeparator" "delete" "fontName" "fontSize" "foreColor" "formatBlock" "forwardDelete" "insertHorizontalRule" "insertHTML" "insertImage" "insertLineBreak" "insertOrderedList" "insertParagraph" "insertText" "insertUnorderedList" "justifyCenter" "justifyFull" "justifyLeft" "justifyRight" "outdent" "paste" "redo" "selectAll" "strikethrough" "styleWithCss" "subscript" "superscript" "undo" "unlink" "useCSS" |
showUI | A Boolean, specifies if the UI should be shown or not |
value | Some commands need a value to be completed |
Technical Details
Return Value: | A Boolean, false if the command is not supported, otherwise true |
---|
Related Pages
DOM Document designMode Property
DOM Element contentEditable Property
❮ Document Object