我如何隐藏文本后的任何点击按钮在jquery

how can i hide text after any click on button in jquery

本文关键字:任何点 按钮 jquery 文本 何隐藏 隐藏      更新时间:2023-09-26

我如何隐藏文本后两次点击在jQuery中的文本?

<!DOCTYPE html>
<html>
    <head>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
        <script>
            $(document).ready(function(){
                $("p").click(function(){
                    $(this).hide("slow");
                });
            });
        </script>
    </head>
    <body>
        <p>If you click on me, I will disappear.</p>
    </body>
</html>

双击事件代码。

$("p").dblclick(function(){
    $(this).hide("slow");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<p>If you click on me, I will disappear.</p>

秒击事件代码。

$("p").click(function(){
    if($(this).hasClass('one'))
        $(this).hide('slow');
    else
        $(this).addClass("one");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<p>If you click on me, I will disappear.</p>