728x90
λ°μν

βοΈ jQuery μ νμ βοΈ
03. jQuery νν° μ νμ
μ νμμ ' : ' κ° λΆμ μ νμλ₯Ό νν° μ νμλΌκ³ ν©λλ€.
[1] κΈ°λ³Έ νν° μ νμ
μ νμ μ’ λ₯ | νν λ°©λ² | μ€λͺ |
---|---|---|
:even | $("tr:even") | tr μμ μ€ μ§μ νλ§ μ ν |
:odd | $("tr:odd") | tr μμ μ€ νμ νλ§ μ ν |
:first | $("tr:first") | 첫 λ²μ§Έ td μμλ₯Ό μ ν |
:last | $("tr:last") | λ§μ§λ§ td μμλ₯Ό μ ν |
:header | $(":header") | ν€λ©(h1~h6) μμλ₯Ό μ ν |
:eq( ) | $("li:eq(0)") | index κ° 0 μΈ li μμλ₯Ό μ ν index λ 0 λ²μ΄ 첫 λ²μ§Έ μμ |
:gt( ) | $("li:gt(0)") | index κ° 0 λ³΄λ€ ν° li μμλ€μ μ ν |
:lt( ) | $("li:lt(2)") | index κ° 2 λ³΄λ€ μμ li μμλ€μ μ ν |
:not( ) | $("li:not(.bg)") | li μμ μ€μμ class μ΄λ¦μ΄ bg κ° μλ li μμλ₯Ό μ ν |
:root | $(":root") | html μ μλ―Έ |
:animated | $(":animated") | μμ§μ΄λ μμλ₯Ό μ ν |
# μμ 1)
[2] μμ νν° μ νμ
'child'κ° λΆμ μ νμλ μμκ° μμ°¨μ μΌλ‘ λμ΄λμ΄ μμ λ μ¬μ©νκ³ , "of-type"μ΄ λΆμ μ νμλ μμκ° μμ°¨μ μΌλ‘ λμ΄λμ΄ μμ§ μμλ λμΌ μμμ΄λ©΄ μ ν κ°λ₯ν©λλ€.
μ νμ μ’ λ₯ | νν λ°©λ² | μ€λͺ |
---|---|---|
:first-child | $("span:first-child") | 첫 λ²μ§Έ span μμλ₯Ό μ ν |
:last-child | $("span:last-child") | λ§μ§λ§ span μμλ₯Ό μ ν |
:first-of-type | $("span:first-of-type") | span μμ μ€μμ 첫 λ²μ§Έ span μμλ₯Ό μ ν |
:last-of-type | $("span:last-of-type") | span μμ μ€μμ λ§μ§λ§ span μμλ₯Ό μ ν |
:nth-child( ) | $("span:nth-child(2)") | λ λ²μ§Έ span μμλ₯Ό μ ν nth-child(2n)μ 2, 4, 6, ...λ²μ§Έ μμλ₯Ό μ ν nth-child(2n+1)μ 1, 3, 5, ...λ²μ§Έ μμλ₯Ό μ ν |
:nth-last-child( ) | $("span:nth-last-child(2)") | λ§μ§λ§μμ λ λ²μ§Έ span μμλ₯Ό μ ν |
:nth-of-type( ) | $("span:nth-of-type(2)") | span μμ μ€μμ λ λ²μ§Έ span μμλ₯Ό μ ν |
:nth-last-of-type( ) | $("span:nth-last-of-type(2)") | span μμ μ€μμ λ§μ§λ§μμ λ λ²μ§Έ span μμλ₯Ό μ ν |
:only-child | $("div > span:only-child") | divμ μμ μμμμ μ€μ§ span μμκ° νλλ§ μλ span μμλ₯Ό μ ν |
:only-of-type | $("div > span:only-of-type") | divμ μμ μμμμ span μμκ° νλλ§ μλ span μμλ₯Ό μ ν |
# μμ 2)
[3] μ½ν μΈ νν° μ νμ
μ νμ μ’ λ₯ | νν λ°©λ² | μ€λͺ |
---|---|---|
:contains( ) | $("p:contains('html')") | p μμ μ€μμ 'html' ν μ€νΈλ₯Ό ν¬ν¨νκ³ μλ p μμλ₯Ό μ ν |
:empty | $("div:empty") | div μμ μ€μμ μμ μμκ° μλ div μμλ₯Ό μ ν |
:parent | $("span:parent") | span μμ μ€μμ μμ μμκ° μλ span μμλ₯Ό μ ν |
:has( ) | $("section:has(article)") | section μμ μ€μμ article μ νμ μμλ‘ κ°μ§κ³ μλ section μμλ₯Ό μ ν |
# μμ 3)
[4] νΌ νν° μ νμ
μ νμ μ’ λ₯ | νν λ°©λ² | μ€λͺ |
---|---|---|
:text | $("input:text") | <input type="text"> μμλ₯Ό μ ν |
:password | $("input:password") | <input type="password"> μμλ₯Ό μ ν |
:image | $("input:image") | <input type="image"> μμλ₯Ό μ ν |
:file | $("input:file") | <input type="file"> μμλ₯Ό μ ν |
:button | $(":button") | <input type="button">, <button> μμλ₯Ό μ ν |
:checkbox | $("input:checkbox") | <input type="techeckboxxt"> μμλ₯Ό μ ν |
:radio | $("input:radio") | <input type="radio"> μμλ₯Ό μ ν |
:submit | $("input:submit") | <input type="submit"> μμλ₯Ό μ ν |
:reset | $("input:reset") | <input type="reset"> μμλ₯Ό μ ν |
:input | $(":input") | λͺ¨λ <input> μμλ₯Ό μ ν |
:checked | $("input:checked") | <input> μμμ checked μμ±μ΄ μλ μμλ₯Ό μ ν |
:selected | $("option:selected") | <option> μμμ selected μμ±μ΄ μλ μμλ₯Ό μ ν |
:focus | $("input:focus") | νμ¬ <input> μ ν¬μ»€μ€κ° μλ μμλ₯Ό μ ν |
:disabled | $("input:disabled") | <input> μμμ disabled μμ±μ΄ μλ μμλ₯Ό μ ν |
:enabled | $("input:enabled") | <input> μμ μ€ disabled κ° μλ μμλ₯Ό μ ν |
# μμ 4)
[5] κ°μμ± νν° μ νμ
μ νμ μ’ λ₯ | νν λ°©λ² | μ€λͺ |
---|---|---|
:hidden | div:hidden | div μμ μ€ hidden μΈ μμλ₯Ό μ ν |
:visible | div:visible | div μμ μ€ visible μΈ μμλ₯Ό μ ν |
# μμ 5)
728x90
λ°μν
'Javascript > jQuery' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
jQuery ν΄λμ€ κ΄λ ¨ λ©μλ (3) | 2022.09.05 |
---|---|
jQuery νμ μ νμ (3) | 2022.09.01 |
jQuery μμ± μ νμ (3) | 2022.09.01 |
jQuery κΈ°λ³Έ μ νμ (3) | 2022.09.01 |
jQuery κΈ°λ³Έ μ¬μ© μ€λͺ (3) | 2022.08.29 |
λκΈ