:root selector

:root Selector

root selector

Description: Selects the element that is the root of the document.

  • version added: 1.9jQuery( ":root" )

In HTML, the root of the document, and thus the element that $(":root") selects, is always the <html> element.

Example:

Display the tag name of the root element.

<!doctype html>
<html lang="en">
&l