본 내용은 w3schools.com 사이트에서 jQuery를 학습하며 메모한 내용들을 정리합니다.
Selector Basic Examples
$(this) // 현재 Element를 선택한다.
$("p") // 모든 <p> Element를 선택한다.
$(".test") // "test" class가 적용된 모든 Element를 선택한다.
$("#test") // id가 "test"인 Element를 선택한다.
$("*") // 모든 Element를 선택한다.
$("p.intro") // "intro" class를 가지는 모든 p Element를 선택한다.
$("p.first") // 첫번째 p Element를 선택한다.
$("ul li:first") // 첫번째 ul Element에서 첫번째 li를 선택한다.
$("ul li:first-child") // 모든 ul Element에서 첫번째 li를 선택한다.
$("[href]") // href 속성을 가진 모든 요소를 선택한다.
$("a[target='_blank']") // target 속성이 "_blank"인 모든 Element를 반환한다.
$("a[target!='_blank']") // target 속성이 "_blank"이 아닌 모든 Element를 반환한다.
$(":button") // type 속성이 "button"인 모든 input element를 반환한다.
$("tr:even") // tr 중에서 모든 짝수 Element를 반환한다.
$("tr:odd") // tr 중에서 모든 홀수 Element를 반환한다.