jQuery fadeIn()
with speed
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"> </script>/*from ww w. ja v a 2 s.c om*/ <script> $(document).ready(function(){ $(".btn1").click(function(){ $("p").fadeOut(1000); }); $(".btn2").click(function(){ $("p").fadeIn(1000); }); }); </script> </head> <body> <button class="btn1">Fade out</button> <button class="btn2">Fade in</button> <p>This is a paragraph.</p> </body> </html>