필터 관련 선택자
- $("대상:선택자")
<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>
<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>
필터링과 관련된 메소드
- 기준이 되는 요소 중에서 특정 요소만을 걸러서 선택해주는 메소드
- $("대상").필터링메소드()
- first(), last(), filter(), not(), eq(index)-인덱스지정
- [선택자 종류 참고] http://www.tcpschool.com/jquery/jq_elementSelection_jqSelector
'IT개발 과정 [취성패 학원] > jQuery' 카테고리의 다른 글
[jQuery] 06. Content영역 관련 메소드 (0) | 2021.04.23 |
---|---|
[jQuery] 05. 탐색(순회)메소드 (0) | 2021.04.23 |
[jQuery] 03. 추가적인 선택자 (0) | 2021.04.20 |
[jQuery] 02. 기본선택자 (0) | 2021.04.20 |
[jQuery] 01. 개요 (0) | 2021.04.20 |