'Selector'에 해당되는 글 12건

  1. 2011.01.06 Child Selector (“parent > child”)
부모 element가 가지고 있는 특정 자식 element들을 선택할 때 사용할 수 있다.

<!DOCTYPE html>
<html>
<head>
  <style>
body { font-size:14px; }
</style>
  <script src="http://code.jquery.com/jquery-1.4.4.js"></script>
</head>
<body>
  
                    
<ul class="topnav">
    <li>Item 1</li>
    <li>Item 2 
        <ul>
<li>Nested item 1</li>
<li>Nested item 2</li>
<li>Nested item 3</li></ul> </li> <li>Item 3</li> </ul> <script>$("ul.topnav > li").css("border", "3px double red");</script> </body> </html>

위 예제는 topnav 라는 클래스명을 가지고 있는 ul element 의 자식 element 중 li element에 대하여
border css를 부여하고 있다.
topnav 라는 클래스를 가지고 있지 않은 ul은 영향을 미치지 않는다.

'jQuery' 카테고리의 다른 글

:has() Selector  (0) 2011.01.06
ID Selector (“#id”) 와 Class Selector (“.class”)  (0) 2011.01.06
:first-child Selector  (0) 2011.01.06
:eq() Selector  (0) 2011.01.06
:last Selector  (0) 2010.12.30
Posted by IT

블로그 이미지
IT

공지사항

Yesterday
Today
Total

달력

 « |  » 2025.5
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함