Attributes - 텍스트 값 가져오기 및 설정
.NET프로그래밍/jQuery 1.3.2 2009. 11. 10. 10:28 |
[Text.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>
<script src="../js/jquery-1.3.2-vsdoc2.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
// get
var text = $('b').text();
alert(text);
// set
$('p:first').text("<b>낼</b> 봐요.");
$('p:last').html("<b>낼</b> 봐요.");
// get
alert($('p:last').html());
});
</script>
</head>
<body>
<div>
안녕하세요. <b>jQuery</b><br />
반갑습니다. <b>JavaScript</b><br />
<p>또 만나요.</p>
<p>언제요?</p>
</div>
</body>
</html>
-------------------------------------------------------------------------------------
[실행결과]
--> 첫 화면.
--> 위의 그림에서 메시지박스의 '확인'버튼 클릭 후의 화면.
--> 바로위의 그림에서 메시지박스의 '확인'버튼 클릭 후의 화면.
'.NET프로그래밍 > jQuery 1.3.2' 카테고리의 다른 글
Traversing - n번째 요소 가져오기 (0) | 2009.11.10 |
---|---|
Attributes - 폼 요소의 값 가져오기 및 설정 (0) | 2009.11.10 |
Attributes - 특정 속성을 지우기 (0) | 2009.11.10 |
Attributes - 맵(컬렉션)으로 다중 속성 지정 (0) | 2009.11.10 |
Attributes - 마우스 오버시 큰 이미지 보여주기 (1) | 2009.11.10 |