Home >>jQuery Tutorial >jQuery root Selector

jQuery root Selector

jQuery root Selector

jQuery root selector in jQuery is used to selects the document's root element is always the <HTML> element.

Syntax:
$(":root")
Here is an Example of jQuery :root Selector

<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", "#97d7fc");
});
</script>
</head>
<body>
<h1>This is Phptpoint</h1>
</body>
</html>

Output:

This is Phptpoint


No Sidebar ads