jQuery :header 选择器
实例
选择所有标题元素 (h1 至 h6):
<!DOCTYPE html><html><head><script src="https://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script><script>$(document).ready(function(){$(":header").css("background-color", "yellow");});</script></head><body><h1>欢迎来到我的主页</h1><h2>我精彩的主页</h2><h3>它很棒!</h3><p class="intro">我的名字叫 Donald.</p><p>我居住在 Duckburg.</p><p>我最好的朋友是 Mickey.</p><p>谁是你最喜欢的:</p><ul id="choose"><li>Goofy</li><li>Mickey</li><li>Pluto</li></ul></body></html>
定义与用法
:header 选择器选择所有标题元素 (h1 至 h6)。
语法
$(":header")