toggleClass 实现属性的反转

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .hide{
            display: none;
        }
    </style>
</head>
<body>
    <div class="hide">asdads</div>
    <input id="i1" type="button" value="开关">
<script src="../jquery-2.12.4.js"></script>
<script>
    $('#i1').click(function () {
        $('div').toggleClass('hide')
    })
</script>
</body>
</html>

 

posted on 2018-07-14 14:51  python我的最爱  阅读(193)  评论(0编辑  收藏  举报