You are here: Reference > JavaScript > client-side > selection and ranges > methods > queryCommandValue (document, TextRange, ...)
queryCommandValue method (document, TextRange, ...)
Returns the actual value of the specified command.
If no value belongs to the specified command, the queryCommandValue method returns false.
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:
If no value belongs to the specified command, it returns false, else the returned value and its type depend on the specified command.
Example HTML code 1:
This example illustrates the use of the queryCommandValue method:
|
||||
<head> <script type="text/javascript"> function GetFont () { alert (document.queryCommandValue ('fontname')); } </script> </head> <body> <div contenteditable="true"> <span style="font-family:arial;">Some text in Arial font.</span> <br /> <span style="font-family:verdana;">Some text in Verdana font.</span> </div> <br /><br /> <button onclick="GetFont ();">Get the font name of the selected text!</button> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
Related pages:
execCommand
queryCommandEnabled
queryCommandIndeterm
queryCommandState
queryCommandSupported
queryCommandText
queryCommandEnabled
queryCommandIndeterm
queryCommandState
queryCommandSupported
queryCommandText
External links:
User Contributed Comments