queryCommandEnabled method (document, TextRange, ...)
Returns whether the execution of the specified command can be successful, using the execCommand method.
The return value of the queryCommandEnabled method sometimes depends on the state of the current selection in Internet Explorer. For example, if no content is selected within the document, the queryCommandEnabled method of the document object returns false for the 'bold' command, but if some text is selected it returns true.
- The use of a non-enabled command for the execCommand method does not raise an exception.
- The use of a non-supported command for the queryCommandEnabled method raises an exception in Internet Explorer.
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. One of the following values:
|The specified command is enabled.|
|The specified command is disabled.|
Example HTML code 1:
This example illustrates the use of the queryCommandEnabled method:
Did you find this example helpful?
User Contributed Comments