본문 바로가기

jQuery

[jQuery] eq 선택자

반응형

[jQuery] eq 선택자


 eq_selector.html

<!doctype html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>jQuery 선택자</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script type="text/javascript">
    jQuery(document).ready(function() {

        //eq 선택자 => 요소 중 index 위치한 요소를 선택하기 위한 선택자
        jQuery("li").eq("1").css("color", "#ff0000");
    });
</script>
</head>
<body>
    <h1>jQuery 선택자</h1>
    <hr/>
    <ul>
        <h2>웹프로그래밍</h2>
        <li>Java 과정</li>
        <ol>
            <li>기본 문법</li>
            <li>OOP 개념</li>
            <li>API 활용</li>
        </ol>
        <li class="important">JSP 과정</li>
        <ol>
            <li>스크립팅 요소</li>
            <li>지시어</li>
            <li>액션태그</li>
        </ol>
    </ul>
</body>
</html>

 출력결과


반응형

'jQuery' 카테고리의 다른 글

[jQuery] css 메소드  (0) 2015.12.20
[jQuery] each 메소드  (0) 2015.12.20
[jQuery] NOT 선택자  (0) 2015.11.16
[jQuery] 필터 선택자  (0) 2015.11.16
[jQuery] 자식 선택자  (0) 2015.11.16