The :root selector selects the document's root element.
In HTML, the root element is always the <html> element.
$(":root")
Set the background color for the HTML document to yellow:
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> $(document).ready(function(){ $(":root").css("background-color", "yellow"); });/*from w w w . j av a2s . c o m*/ </script> </head> <body> <h1>This is a heading</h1> </body> </html>