HTML DOM execCommand() Method
Definition and Usage
The execCommand()
method executes the specified command for the selected part of an editable section.
Browser Support
Method | |||||
---|---|---|---|---|---|
execCommand() | Yes | Yes | Yes | Yes | Yes |
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" "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