티스토리 뷰
<script>
$(document).ready(function () {
$('td').filter(function (index, selector) {
if (index % 2 == 0) {
$(selector).css('background-color', 'red');
}
});
});
</script>
필터는 셀렉터를 가져올 수 있음, 순서에 따라 조건을 넣어서 사용 할 수 있다.
필터 메서드의 메서드 체이닝(Chaining)
여러 필터 메서드를 사용하는데에 있어서의 장점은 메서드 체이닝을 지원한다는 사실입니다. 다음과 같이 css() 메서드를 사용하고 나서 jQuery dom 객체를 반환하므로 연달아서 필터 메서드를 사용할 수 있는 장점이 있고, 코드를 훨씬 간결하게 작성할 수 있습니다.
<script>
$(document).ready(function () {
$('td')
.css('background-color', 'red')
.eq(3)
.css('background-color', 'green');
});
</script>
|
출처: https://dololak.tistory.com/416 [코끼리를 냉장고에 넣는 방법:티스토리]
<script>
$(document).ready(function () {
var firstValue = $('td').first().text();
var lastValue = $('td').last().text();
console.log('first() = ' + firstValue);
console.log('last() = ' + lastValue);
});
</script>
|
출처: https://dololak.tistory.com/416 [코끼리를 냉장고에 넣는 방법:티스토리]
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- SpringBoot
- react실행
- exception
- 인터셉터
- filter
- 백엔드 개발자 역량
- 컨트
- 항해플러스
- 항해99
- 향해플러스백엔드
- 향해99
- HTTP
- Java
- JPA
- reject
- ArgumentResolver
- 리터럴
- 스프링부트
- BindingResult
- 향해플러스
- React
- rejectValue
- 예외처리
- 로그인
- Intercepter
- 스프링공부
- hypertexttransferprotocol
- thymleaf
- jpa api
- 백엔드 개발자 공부
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
글 보관함