You are here: Reference > JavaScript > client-side > selection and ranges > methods > queryCommandIndeterm (document, TextRange, ...)
queryCommandIndeterm method (document, TextRange, ...)
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.
Syntax:
You can find the related objects in the Supported by objects section below.
Parameters:
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:
The specified command is in indeterminate state. | |
The specified command is not in indeterminate state. |
Example HTML code 1:
This example illustrates the use of the queryCommandIndeterm method:
|
||||
<head> <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); } </script> </head> <body> <div contenteditable="true">Select a part of this text!</div> <br /><br /> <button onclick="SetToBold ();">Test the state of the 'bold' command</button> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
Related pages:
execCommand
queryCommandEnabled
queryCommandState
queryCommandSupported
queryCommandText
queryCommandValue
queryCommandEnabled
queryCommandState
queryCommandSupported
queryCommandText
queryCommandValue
External links:
User Contributed Comments