queryCommandState method (document, TextRange, ...)
Returns the current state of the specified command.
The effect of some commands depend on the current state of their target. For example, if the 'bold' command is executed by the execCommand method on a bold text, the bold formatting will be removed; otherwise it makes the text bold. So the queryCommandState method for the 'bold' command returns true on a bold text and returns false otherwise.
You can find the related objects in the Supported by objects section below.
|Required. A case-insensitive string that specifies the name of the command. See command identifiers for more information.|
Boolean or null. One of the following values:
|The specified command was previously not executed on the target.|
|The specified command was previously executed on the target.|
|The state of the specified command is indeterminable.|
Example HTML code 1:
This example illustrates the use of the queryCommandState method:
Did you find this example helpful?
User Contributed Comments