JavaScript document.queryCommandState() Method
JavaScript document.queryCommandState() Method
The document.queryCommandState()
method returns the current state of the specified command.
Example
Syntax
Parameter Values
Value | Type | Explanation |
---|---|---|
cmd | Required | A DOMString specifying the name of the command to determine state. The following are the list of DOMString. backColorChanges the document background color. boldToggles bold on/off for the selection. ClearAuthenticationCacheClears all authentication credentials from the cache. contentReadOnlyMakes the content document either read-only or editable. copyCopies the current selection to the clipboard. createLinkCreates an hyperlink from the selection, but only if there is a selection. cutRemoves the current selection and copies it to the clipboard. decreaseFontSizeAdds a <small> tag around the selection. defaultParagraphSeparatorChanges the paragraph separator used when new paragraphs are created in editable text regions. deleteDeletes the current selection. enableAbsolutePositionEditorEnables or disables the grabber that allows absolutely-positioned elements to be moved around. enableInlineTableEditingEnables or disables the table row/column insertion and deletion controls. enableObjectResizingEnables or disables the resize handles on images, tables, and absolutely-positioned elements and other resizable objects. fontNameChanges the font name for the selection. fontSizeChanges the font size for the selection. foreColorChanges a font color for the selection. formatBlockAdds an HTML block-level element around the line containing the current selection. forwardDeleteDeletes the character ahead of the cursor's position. Similar to pressing the Delete key on a windows keyboard. headingAdds a heading element around a selection. hiliteColorChanges the background color for the selection. increaseFontSizeAdds a <big> tag around the selection. indentIndents the line containing the selection. insertBrOnReturnControls whether the Enter key inserts a <br> element, or splits the current block element into two. insertHorizontalRuleInserts a <hr> element at the insertion point, or replaces the selection with it. insertHTMLInserts an HTML string at the selection. insertImageInserts an image at the Selection. insertOrderedListCreates a numbered ordered list for the selection. insertUnorderedListCreates a bulleted unordered list for the selection. insertParagraphInserts a paragraph around the selection. insertTextInserts the given plain text at the selection. italicToggles italics on/off for the selection. justifyCenterCenters the selection. justifyFullJustifies the selection. justifyLeftLeft-Justifies the selection. justifyRightRight-justifies the selection. outdentOutdents the line containing the selection. pastePastes the clipboard contents at the selection. redoRedoes the previous undo command. removeFormatRemoves all formatting from the current selection. selectAllSelects all of the content of the editable region. strikeThroughToggles strikethrough on/off for the selection. subscriptToggles subscript on/off for the selection. superscriptToggles superscript on/off for the selection . underlineToggles underline on/off for the selection. undoUndoes the last executed command. unlinkRemoves the anchor element from a selected hyperlink. styleWithCSSReplaces the useCSS command. useCSSToggles the use of HTML tags or CSS for the generated markup. |
Return Values
Value | Explanation |
---|---|
true | If the command is active. |
false | If the command is not active. |
Reminder
Hi Developers, we almost covered 97% of JavaScript Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in JavaScript.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.