This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The Selection.selectAllChildren() method adds all the children of the specified node to the selection. Previous selection is lost.

Syntax

sel.selectAllChildren(parentNode)

Parameters

parentNode
All children of parentNode will be selected. parentNode itself is not part of the selection.

Examples

footer = document.getElementById("footer");
window.getSelection().selectAllChildren(footer);
// Everything inside the footer is now selected

Specifications

Specification Status Comment
HTML Editing APIs
The definition of 'Selection.selectAllChildren()' in that specification.
Editor's Draft Initial definition
Selection API
The definition of 'Selection.selectAllChildren()' in that specification.
Working Draft Current definition

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic support
Experimental
Chrome Full support YesEdge Full support YesFirefox Full support YesIE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.

See also

Document Tags and Contributors

Last updated by: mfluehr,