필터 관련 선택자
•
$("대상:선택자")
<table border="1">
<tr>
<th>이름</th>
<th>혈액형</th>
<th>거주지</th>
</tr>
<tr>
<td>홍길동</td>
<td>A형</td>
<td>서울</td>
</tr>
<tr>
<td>김영희</td>
<td>B형</td>
<td>경기도</td>
</tr>
<tr>
<td>김삼순</td>
<td>O형</td>
<td>부산</td>
</tr>
<tr>
<th colspan="2">총인원</th>
<td>3명</td>
</tr>
</table>
HTML
복사
<script>
$(function(){
$("tr:first").css("backgroundColor", "black").css("color", "white");
$("tr:last").css({backgroundColor:"red", color:"white"});
$("tr:even").css("backgroundColor", "lightgray");
$("tr:odd").css("backgroundColor", "yellow");
})
</script>
JavaScript
복사
결과물
필터링과 관련된 메소드
•
기준이 되는 요소 중에서 특정 요소만을 걸러서 선택해주는 메소드
•
$("대상").필터링메소드()
•
first(), last(), filter(), not(), eq(index)-인덱스지정



