18. eq() / qt() / lt() / not()
1 2 3 4 | $('p:gt(2)').css("background-color", "brown"); // n보다 큰 index 태그들 $('p:eq(2)').css("background-color", "yellow"); // 해당 index값 $('p:lt(2)').css("background-color", "red"); // n보다 작은 index $('p:not(.intro)').css("background-color", "yellow"); // 선택자에 해당되는것 제외하고 적용 | cs |
:eq(index)
- 해당 index값에 요소 적용
:qt(index)
- 해당 index값보다 큰 인덱스에 요소 적용
:lt(index)
- 해당 index값보다 작은 인덱스에 요소 적용
:not(selector)
- 해당 sclector을 제외한 요소에만 적용
19. :header
1 | $(":header").css("background", "brown"); | cs |
:header == $('h1, h2, h3, h4, h5, h6)
이 정도면 이해가 갈 것 같다.
'이전 글 > JQuery' 카테고리의 다른 글
7. jQuery 선택자 - 계층 선택자( '~' , ' ' , '+' , '>' ) (0) | 2018.01.23 |
---|---|
6. jQuery 선택자 - :even / :odd / :only-child / :only-of-type (0) | 2018.01.23 |
5. jQuery 선택자 - :nth-child / nth-of-type / :nth-last-child / nth-last-of-type (0) | 2018.01.23 |
4. jQuery 선택자 - :first / :first-child / :first-of-type / :last / :last-child / :last-of-type (0) | 2018.01.23 |
3. jQuery 선택자 - * / #/ . / [] / element (0) | 2018.01.23 |