Toggle between hide()
and show()
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"> </script>/* w w w. jav a 2 s.com*/ <script> $(document).ready(function(){ $("button").click(function(){ $("p").toggle(1000, function(){ document.getElementById("demo").innerHTML = "The toggle() method is finished!"; }); }); }); </script> </head> <body> <p id="demo"></p> <p>This is a paragraph.</p> <button>Test</button> </body> </html>