PHP群:95885625 Hbuilder+MUI群:81989597 站长QQ:634381967
    您现在的位置: 首页 > 开发编程 > Jquery教程 > 正文

    jquery 标题点击高亮内容显示,点击不高亮内容隐藏

    作者:admin来源:网络浏览:时间:2020-09-30 00:07:50我要评论
    导读:jquery 标题点击高亮内容显示,点击不高亮内容隐藏 。
    <html>
    <head>
    <title>jQuery</title>
    <style>
    .ccc{ background:red;}
    </style>
    <script type="text/javascript" src="jquery-1.7.2.min.js"></script>
    <script>
    $(function(){
    $(".one h2.two").toggle(function(){
    $(this).addClass("ccc");
    $(this).next().show();
    },function(){
    $(this).removeClass('ccc');
    $(this).next().hide();
    })
    });
    </script>
    </head>
    <body>
    <div class="one">
    <h2 class="two">标题</h2>
    <div class="three">
    sdafdsafadsfdasfdasfasfasfasfasfasfasfsafasfdasfa
    </div>
    </div>
     
    </body>
    </html>
    转载请注明(B5教程网)原文链接:https://b5.mxunkeji.com/content-47-396-1.html
    相关热词搜索: jquery 高亮 隐藏