首頁  >  選擇器  > :header

返回值:Array<Element(s)> :header

V1.2 概述

匹配如 h1, h2, h3之類的標題元素

示例

描述:

給頁面內所有標題加上背景色

HTML 程式碼:

<h1>Header 1</h1>
<p>Contents 1</p>
<h2>Header 2</h2>
<p>Contents 2</p>
jQuery 程式碼:

$(":header").css("background", "#EEE");
結果:

[ <h1 style="background:#EEE;">Header 1</h1>, <h2 style="background:#EEE;">Header 2</h2> ]