Latest web development tutorials

jQuery :root 選擇器

jQuery 選擇器 jQuery選擇器

實例

設置HTML 文檔的背景顏色為黃色:

$(":root").css("background-color","yellow");

嘗試一下»

定義和用法

:root 選擇器選取文檔的根元素。

在HTML 中,根元素總是<html> 元素。


Syntax

$(":root")


jQuery 選擇器 jQuery選擇器