[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>

 



-------------------------------------------------------------------------------------




[실행결과]

--> 첫 화면.





--> 위의 그림에서  메시지박스의 '확인'버튼 클릭 후의 화면.




--> 바로위의 그림에서  메시지박스의 '확인'버튼 클릭 후의 화면.





Posted by holland14
: