[英]how can i hide text after any click on button in jquery
在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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.