You are here: Reference > JavaScript > client-side > selection and ranges > methods > queryCommandIndeterm (document, TextRange, ...)

queryCommandIndeterm method (document, TextRange, ...)

Browser support:
Returns whether the specified command is in an indeterminate state.
Indeterminate state means that the queryCommandState method cannot detect the current state of the command, therefore it will return null.


object.queryCommandIndeterm (commandIdentifier);
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.

Return value:

Boolean. One of the following values:
false The specified command is in indeterminate state.
true The specified command is not in indeterminate state.

Example HTML code 1:

This example illustrates the use of the queryCommandIndeterm method:
    <script type="text/javascript">
        function SetToBold () {
            if (document.queryCommandIndeterm ("bold")) {
                alert ("The 'bold' command is in an indeterminate state.");
            else {
                if (document.queryCommandState ("bold")) {
                    alert ("The bold formatting will be removed from the selected text.");
                else {
                    alert ("The selected text will be displayed in bold.");
            document.execCommand ('bold', false, null);
    <div contenteditable="true">Select a part of this text!</div>
    <br /><br />
    <button onclick="SetToBold ();">Test the state of the 'bold' command</button>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content