:header 는 h1, h2, h3 와 같은 제목 요소(header element)들을 선택해 줍니다.
원문 링크
http://api.jquery.com/header-selector/
- jQuery(':header')
예 제
제목 태그를 찾아서 회색 바탕에 파란색 글씨 색깔로 바꿉니다.
<!DOCTYPE html>
<html>
<head>
<style>
body { font-size: 10px; font-family: Arial; }
h1, h2 { margin: 3px 0; }
</style>
<script src="http://code.jquery.com/jquery-1.4.4.js"></script>
</head>
<body>
<h1>Header 1</h1>
<p>Contents 1</p>
<h2>Header 2</h2>
<p>Contents 2</p>
<script>$(":header").css({ background:'#CCC', color:'blue' });</script>
</body>
</html>
미리보기
네! 참 쉽죠~. 잘 따라해 보세요~.
그럼 즐프하세요.
※ 본 예제는 http://www.jquery.com 에 있는 내용임을 밝힙니다.
'프로그래밍 > jQuery' 카테고리의 다른 글
| jQuery API 정복 - 폼에 속한 input 들 선택하기 : jQuery(':input') (0) | 2011.02.11 |
|---|---|
| jQuery API 정복 - image 폼 요소 찾기 : jQuery(":image") (0) | 2011.02.10 |
| jQuery API 정복 - ID 로 찾아내기 : jQuery("#id") (7) | 2011.02.10 |
| jQuery API 정복 - 안보이는 요소 찾기 : jQuery(':hidden') (1) | 2011.02.10 |
| jQuery API 정복 - 자식 중에 태그 찾기 : jQuery(':has(selector)') (30) | 2011.02.09 |
| jQuery API 정복 - 속성이 있는지 찾기 : jQuery('[attribute]') (10) | 2011.02.08 |
| jQuery API 정복 - 내용이 빈 태그 찾기 : jQuery(':empty') (7) | 2011.02.08 |
| jQuery API 정복 - 요소명(태그)으로 찾기 : jQuery('element') (0) | 2011.02.07 |