Traversing - 방금 실행한 집합 이전으로 되돌리기
.NET프로그래밍/jQuery 1.3.2 2009. 11. 10. 13:11 |
[End.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>방금 실행한 집합 이전으로 되돌리기</title>
<style type="text/css">
.Yellow { background-color:Yellow; }
</style>
<script src="../js/jquery-1.3.2-vsdoc2.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
//[1] JavaScript 텍스트 찾아가기
alert($('div').find('p').html());
//[2] JavaScript 텍스트로 찾아가기
var result = $('div').find('p:last').find('b').html();
alert(result); // jQuery
//[3] 방금 탐색한 기능 이전으로 돌리기
var html = $('div').find('p:last').find('b').end().html();
alert(html); // jQuery -> end() -> <b>jQuery</b>
});
</script>
</head>
<body>
<div id="myForm">
<p>
<b>JavaScript</b>
</p>
<p>
<b>jQuery</b>
</p>
</div>
</body>
</html>
-------------------------------------------------------------------------------------
[실행결과]
--> 첫 화면.
.
--> 위의그림에서 메시지박스의 '확인'버튼을 누른 후의 화면.
--> 바로위의 그림에서 메시지박스의 '확인'버튼을 누른 후의 화면.(위의 [End.htm]소스코드에서 [3] 방금 탐색한 기능 이전으로 돌리기( jQuery -> end() -> <b>jQuery</b> 의 과정으로 아래그림과 같이 출력된 것이다. )
--> 바로위의 그림에서 메시지박스의 '확인'버튼을 누른 후의 화면.(마지막 화면.)
'.NET프로그래밍 > jQuery 1.3.2' 카테고리의 다른 글
Manipulation - DOM 요소의 앞/뒤에 요소 추가 (0) | 2009.11.11 |
---|---|
Manipulation - Append() 메서드 (DOM 요소 생성 후 원하는 요소에 추가) (0) | 2009.11.11 |
Traversing - 지정된 표현식을 제외한 집합 가져오기 (0) | 2009.11.10 |
Traversing - 지정된 표현식이 있는지 없는지 검사 (0) | 2009.11.10 |
Traversing - n번째 요소 가져오기 (0) | 2009.11.10 |