const flg = document.queryCommandEnabled("SelectAll");
if (flg) {
document.execCommand("SelectAll", false, null); // command is enabled, run it
}Document: queryCommandEnabled() method / notebook
Document: queryCommandEnabled() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.