jquery的toggle()函数,显示/隐藏交替

<!DOCTYPE html>
<html lang="en">
<head>
<script src="jquery.js"></script>
    <meta charset="UTF-8">
    <title>lfj</title>
    <style>
         .one {      
            background-color:yellow;
        }
        .two {
            background-color: pink;
        }
    </style>
</head>
<body>
    <div class='one'>        one    </div>
    <div class="two">       two    </div>
</body>
<script>
    $(".one").click(function(){
        $(".two").toggle();
    })
</script>
</html>

 

posted @ 2022-02-15 17:12  勋勋的大宝贝  阅读(89)  评论(0编辑  收藏  举报