• 코드:
​x
 
1
<!DOCTYPE html>
2
<html lang="ko">
3
​
4
<head>
5
    <meta charset="UTF-8">
6
    <title>jQuery Effects</title>
7
    <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
8
    <script>
9
        $(function() {
10
            $("#toggleBtn").on("click", function() {
11
                $("#text").toggle("slow");  // id가 "text"인 요소를 느리게 나타나게 하거나 숨김.
12
            });
13
        });
14
    </script>
15
</head>
16
​
17
<body>
18
​
19
    <h1>요소의 표시 상태 토글</h1>
20
    <button id="toggleBtn">요소 표시 토글</button>
21
    <p id="text">이 단락을 숨기거나 나타나게 할 거에요!</p>
22
    
23
</body>
24
​
25
</html>