Menu



Manage

파일 목록
Study_Web > 이후/jquery/ex11-10.html Lines 34 | 924 바이트
다운로드

                        <!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/jquery.js"></script>
    <script>
        $(function () {
            let result_1 = $("#sec_1").html();
            console.log(result_1);
            $("#sec_1 p").html("<a href=\’#\’>Text1</a>");
            let result_2 = $("#sec_2").text();
            console.log(result_2);
            $("#sec_2 h2").text("text()2");
        });
    </script>
</head>

<body>
    <h1><strong>객체 조작 및 생성</strong></h1>
    <section id="sec_1">
        <h2><em>html()</em></h2>
        <p>내용1</p>
    </section>
    <section id="sec_2">
        <h2><em>텍스트()</em></h2>
        <p>내용2</p>
    </section>
</body>

</html>