jQuery | javascript | CSS

33.jQuery - Eq ( 04.Traversing - 01.Eq)

Godffs 2009. 11. 11. 09:40
반응형
eq(index) : n번째 인덱스의 요소를 가져옴

01.Eq.htm

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <title>n번째 요소 가져오기</title>

    <script src="../jQuery/jquery-1.3.2-vsdoc2.js" type="text/javascript"></script>

    <script type="text/javascript">

        $(document).ready(function() {

            //alert($('p').html() 하면 첫번째만 읽어온다.

            alert($('p').text()); //선택기 필터

            alert($('p').html()); //메서드

        });

    </script>

</head>

 

<body>

    <p>C#</p>

    <p>ASP.NET</p>

    <p>jQuery</p>   

</body>

</html>


결과화면

[그림33-1]



반응형