Javascript Ajax jQuery Html PHP Example Quiz New MORE

How to Fade-In and Fade-Out in jQuery


In this example we will discuss How to Fade-In and Fade-Out in jQuery.

<!DOCTYPE html>  
<html lang="en">  
<head>  
  <meta charset="utf-8">  
  <title>Fade in boxes</title>  
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
  <style>  
  	h2 {  
    	color: white;  
        text-align:center;
        padding-top:40px;
  	}  
  </style>  
  <script type="text/javascript">
$(document).ready(function(){
  $("#button").click(function(){
    $("#div").fadeIn("slow");//The required speed parameter values: "slow", "fast", or milliseconds.
  });
});
</script> 
</head>  
<body>
<button id="button">fade in boxes</button>
<br>
<br>
<div id="div" style="width:400;height:100px;display:none;background-color:green;"><h2 style="color:white;text-align:center;padding-top:40px;">STUDENTS TUTORIAl</h2></div>
</body>  
</html>

Run it Yourself »