jQuery Selectors
Use our excellent jQuery Selector Tester to experiment with the different selectors.
| Selector | Example | Selects |
|---|---|---|
| * | $("*") | All elements - 모든엘리먼트 접근 |
| #id | $("#lastname") | The element with id=lastname - ID로 접근 |
| .class | $(".intro") | All elements with class="intro" - class로 접근 |
| element | $("p") | All p elements - 태그이름으로 접근 |
| .class.class | $(".intro.demo") | All elements with the classes "intro" and "demo" |
:first | $("p:first") | The first p element ( 엘리먼트의 첫번째 ) |
| :last :last-child | $("p:last") | The last p element ( 엘리먼트의 마지막 ) |
| :even | $("tr:even") | All even tr elements - 홀수 |
| :odd | $("tr:odd") | All odd tr elements - 짝수 |
| :eq(index) | $("ul li:eq(3)") | The fourth element in a list (index starts at 0) 태그의 몇번째(index) |
| :gt(no) | $("ul li:gt(3)") | List elements with an index greater than 3 |
| :lt(no) | $("ul li:lt(3)") | List elements with an index less than 3 태그의 처음부터 몇번째(no)까지 |
| :not(selector) | $("input:not(:empty)") | All input elements that are not empty |
| :header | $(":header") | All header elements h1, h2 ... - <h1><h2>등등 h태그 |
| :animated | $(":animated") | All animated elements - 애니메이션 걸린 엘리먼트 |
| :contains(text) | $(":contains('W3Schools')") | All elements which contains the text |
| :empty | $(":empty") | All elements with no child (elements) nodes |
| :hidden | $("p:hidden") | All hidden p elements - 숨겨진 엘리먼트 |
| :visible | $("table:visible") | All visible tables |
| s1,s2,s3 | $("th,td,.intro") | All elements with matching selectors |
| [attribute] | $("[href]") | All elements with a href attribute |
| [attribute=value] | $("[href='default.htm']") | All elements with a href attribute value equal to "default.htm" |
| [attribute!=value] | $("[href!='default.htm']") | All elements with a href attribute value not equal to "default.htm" |
| [attribute$=value] | $("[href$='.jpg']") | All elements with a href attribute value ending with ".jpg" |
| [attribute^=value] | $("[href^='jquery_']") | All elements with a href attribute value starting with "jquery_" |
| :input | $(":input") | All input elements |
| :text | $(":text") | All input elements with type="text" |
| :password | $(":password") | All input elements with type="password" |
| :radio | $(":radio") | All input elements with type="radio" |
| :checkbox | $(":checkbox") | All input elements with type="checkbox" |
| :submit | $(":submit") | All input elements with type="submit" |
| :reset | $(":reset") | All input elements with type="reset" |
| :button | $(":button") | All input elements with type="button" |
| :image | $(":image") | All input elements with type="image" |
| :file | $(":file") | All input elements with type="file" |
| :enabled | $(":enabled") | All enabled input elements |
| :disabled | $(":disabled") | All disabled input elements |
| :selected | $(":selected") | All selected input elements |
| :checked | $(":checked") | All checked input elements |
'Front-End > jQuery' 카테고리의 다른 글
| Effect - Reference(API) (0) | 2012.04.06 |
|---|---|
| Events - Reference(API) (0) | 2012.04.06 |
| Selectors - this의 chlildNode 이동하기 (0) | 2012.04.06 |
| Selectors - 요약&정리 (0) | 2012.04.05 |
| 이클립스에 jQuery 플러그인 설치하기 (0) | 2012.04.05 |