javascript - how can i hide text after any click on button in jquery -
how can hide text after 2 click on text in 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 click on me, disappear.</p> </body> </html>
code double click event.
$("p").dblclick(function(){ $(this).hide("slow"); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> <p>if click on me, disappear.</p>
code second click event.
$("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 click on me, disappear.</p>
Comments
Post a Comment