💻
jQuery
  • 제이쿼리
  • 제이쿼리 기본
  • 선택자
    • 기본 선택자
    • 계층 선택자
    • 속성 선택자
    • 기본 필터 선택자
    • 내용 필터 선택자
    • 보임 필터 선택자
    • 자식 요소 필터 선택자
    • 폼 요소 필터 선택자
  • 탐색
    • find() / filter()
    • each() / $.each()
  • 속성
    • position() / offset()
    • addClass() / removeClass()
    • toggleClass()
    • hasClass()
    • Attr() / removeAttr()
    • scrollTop() / scrollLeft()
  • 변경
    • text() / html()
    • append() / prepend()
    • remove() / empty()
  • 애니메이션
    • show() / hide()
    • fadeIn() / fadeOut()
    • slideUp() / slideDown()
    • animate()
  • 이벤트
Powered by GitBook
On this page

Was this helpful?

  1. 선택자

자식 요소 필터 선택자

Previous보임 필터 선택자Next폼 요소 필터 선택자

Last updated 4 years ago

Was this helpful?

자식 요소 필터 선택자

$("li:first").css({backgroundColor:"#bbdefb", border:"1px dashed #303f9f", color: "#fff"}); //첫번째
$("li:first-child").css({backgroundColor:"#bbdefb", border:"1px dashed #303f9f", color: "#fff"}); //첫째의 첫 자식과 첫 손주
$("li:last").css({backgroundColor:"#bbdefb", border:"1px dashed #303f9f", color: "#fff"}); //마지막
$("li:last-child").css({backgroundColor:"#bbdefb", border:"1px dashed #303f9f", color: "#fff"}); //막내의 막내 자식과 막내 손주
$("li:nth-child(4)").css({backgroundColor:"#bbdefb", border:"1px dashed #303f9f", color: "#fff"}); //넷째의 넷째 자식과 넷째 손주
$("li:nth-child(4n)").css({backgroundColor:"#bbdefb", border:"1px dashed #303f9f", color: "#fff"}); //4의 곱의 자식과 손주
$("li:nth-child(2n+1)").css({backgroundColor:"#bbdefb", border:"1px dashed #303f9f", color: "#fff"}); //모든 홀수의 자식과 손주
$("li:nth-child(odd)").css({backgroundColor:"#bbdefb", border:"1px dashed #303f9f", color: "#fff"}); //모든 홀수 자식과 손주
$("li:nth-child(even)").css({backgroundColor:"#bbdefb", border:"1px dashed #303f9f", color: "#fff"}); //모든 짝수 자식과 손주
$("li:only-child").css({backgroundColor:"#bbdefb", border:"1px dashed #303f9f", color: "#fff"});