We're looking for a person or people to help audit MDN to find places we could speed up. Is this you or someone you know? Check out the RFP: https://mzl.la/2IHcMiE

Unsere Freiwilligen haben diesen Artikel noch nicht in Deutsch übersetzt. Machen Sie mit und helfen Sie, das zu erledigen!
Sie können den Artikel auch auf English (US) lesen.

The Document.queryCommandEnabled() method reports whether or not the specified editor command is enabled by the browser.


isEnabled = document.queryCommandEnabled(command);


The command for which to determine support.

Return value

Returns a Boolean which is true if the command is enabled and false if the command isn't.


  • For 'cut' and 'copy' commands the method only returns true when called from a user-initiated thread.
  • The 'paste' command return false not only if the feature is unavailable, but also if the script calling it has insufficient privileges to perform the action.


var flg = document.queryCommandEnabled("SelectAll");

if(flg) {
  document.execCommand("SelectAll", false, null); // command is enabled, run it


Specification Status Comment
HTML Editing APIs
The definition of 'querycommandenabled' in that specification.
Editor's Draft Initial definition

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support 17 (Yes) 9.0 (9.0)[1] 4.0 ? ?
Feature Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? (Yes) 9.0 (9.0)[1] ? ? ?

[1] Before Firefox 41, queryCommandEnabled() with arguments cut, copy or paste would throw errors unless the script had special privileges.

See also

Schlagwörter des Dokuments und Mitwirkende

 Mitwirkende an dieser Seite: mfluehr, erikadoyle, Sebastianz, teoli, hallvors
 Zuletzt aktualisiert von: mfluehr,