웹/제이쿼리 JSTL

제이쿼리(jQurey) load,div onclick, show, hide ,visible 간단예제

은은하게미친자 2022. 7. 12. 11:24
728x90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<script src="https://code.jquery.com/jquery-latest.min.js"></script>
<script>
    $(document).ready(function () {
        $("userclass").hide();
        $(window).load(function(){
            $("#pw1").hide();
        });
 
        $("#content1").click(function(){
            if($("#pw1").css("display")=="none"){
                $("#pw1").show();    
            } else{
                $("#pw1").hide();    
            }
        });
        $(".content2").click(function(){
            if($("userclass.pw2").is(':visible')){
                $("userclass.pw2").hide();    
            } else{
                $("userclass.pw2").show();    
            }
        });
 
    });
</script>
<body>
    <div>
        <h1>대한민국의 수도는 어디입니까?</h1>
        <div id="content1">[정답보기]</div>
        <p id="pw1">대한민국의수도는 <strong>서울</strong>입니다.</p>
        
        
        <h1>대한민국의 국보1호는 어디입니까?</h1>
        <div class="content2">[정답보기]</div>
        <userclass class="pw2">서울 <strong></strong>례문(서울 崇禮門)(Sungnyemun Gate, Seoul)</userclass>
 
 
    </div>
 
</body>
</html>
cs

 

 

 

 

 

728x90