Traversing - n번째 요소 가져오기
.NET프로그래밍/jQuery 1.3.2 2009. 11. 10. 11:29 |
[Eq.htm]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>n번째 요소 가져오기</title>
<script src="../js/jquery-1.3.2-vsdoc2.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
alert($('p:eq(2)').text()); // 선택기 필터
alert($('p').eq(2).html()); // 메서드
});
</script>
</head>
<body>
<p>C#</p>
<p>ASP.NET</p>
<p>jQuery</p>
</body>
</html>
-------------------------------------------------------------------------------------
[실행결과]
--> 바로 아래 2개의 그림은, 위의 [Eq.htm]소스코드에서 한번은 "선택기 필터"를 사용해서, 또 한번은 "Traversing 메서드"를 사용해서 같은 결과를 2번 출력해 본 결과이다.
--> 바로 위의 그림에서 메시지박스의 '확인'버튼을 누른 후의 화면.(마지막 화면)
'.NET프로그래밍 > jQuery 1.3.2' 카테고리의 다른 글
Traversing - 지정된 표현식을 제외한 집합 가져오기 (0) | 2009.11.10 |
---|---|
Traversing - 지정된 표현식이 있는지 없는지 검사 (0) | 2009.11.10 |
Attributes - 폼 요소의 값 가져오기 및 설정 (0) | 2009.11.10 |
Attributes - 텍스트 값 가져오기 및 설정 (0) | 2009.11.10 |
Attributes - 특정 속성을 지우기 (0) | 2009.11.10 |