jQuery 참조 매뉴얼 - 선택자

jQuery 선택자

선택자 예제 선택
* $("*") 모든 요소
#id $("#lastname") id="lastname"인 요소
.class $(".intro") 모든 class="intro"인 요소
element $("p") 모든 <p> 요소
.class.class $(".intro.demo") class="intro" 이고 class="demo"인 모든 요소
     
:first $("p:first") 첫 번째 <p> 요소
:last $("p:last") 마지막 <p> 요소
:even $("tr:even") 모든 짝수 <tr> 요소
:odd $("tr:odd") 모든 홀수 <tr> 요소
     
:eq(index) $("ul li:eq(3)") 리스트의 네 번째 요소(index는 0부터 시작합니다)
:gt(no) $("ul li:gt(3)") index가 3보다 큰 요소를 나열합니다
:lt(no) $("ul li:lt(3)") index가 3보다 작은 요소 목록
:not(selector) $("input:not(:empty)") 모든 비어있지 않은 input 요소
     
:header $(:header) 모든 제목 요소 <h1> - <h6>
:animated   모든 애니메이션 요소
     
:contains(text) $(:contains('W3School')) 지정된 문자열을 포함하는 모든 요소
:empty $(:empty) 자식(요소) 노드가 없는 모든 요소
:hidden $("p:hidden") 모든 숨겨진 <p> 요소
:visible $("table:visible") 모든 보이는 테이블
     
s1,s2,s3 $("th,td,.intro") 모든 일치하는 선택자를 가진 요소
     
[attribute] $("[href]") 모든 href 속성을 가진 요소
[attribute=value] $("[href='#']") href 속성의 값이 "#"인 모든 요소
[attribute!=value] $("[href!='#']") href 속성의 값이 "#"이 아닌 모든 요소
[attribute$=value] $("[href$='.jpg']") href 속성의 값이 ".jpg"으로 끝나는 모든 요소
     
:input $(:input) 모든 <input> 요소
:text $(:text) 모든 type="text"의 <input> 요소
:password $(:password) 모든 type="password"의 <input> 요소
:radio $(:radio) 모든 type="radio"의 <input> 요소
:checkbox $(:checkbox) 모든 type="checkbox"의 <input> 요소
:submit $(:submit) 모든 type="submit"의 <input> 요소
:reset $(:reset) 모든 type="reset"의 <input> 요소
:button $(:button) 모든 type="button"의 <input> 요소
:image $(":image") 모든 type="image"의 <input> 요소
:file $(":file") 모든 type="file"의 <input> 요소
     
:enabled $(":enabled") 모든 활성된 input 요소
:disabled $(":disabled") 모든 비활성된 input 요소
:selected $(":selected") 모든 선택된 input 요소
:checked $(":checked") 모든 선택된 input 요소

참조

교육:jQuery 요소 선택기 문법