Javascript Ajax jQuery Html PHP Example Quiz New MORE
Need a Website Or Web Application Or Any Help In Code As Per Your Budget, Contact Us: +91 9437911966 (Whatsapp)

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>How to Fade-In and Fade-Out in jQuery</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<style type="text/css">
    div{
        padding: 14px;
        background: lightgreen;
    }
</style>
<script type="text/javascript">
$(document).ready(function(){
   	$("#fade_out").click(function(){
        $("div").fadeOut();
    });
    $("#fade_in").click(function(){
        $("div").fadeIn();
    });
});
</script>
</head>
<body>
    <button type="button" id="fade_out">Fade Out Paragraphs</button>
    <button type="button" id="fade_in">Fade In Paragraphs</button>
    <br><br>
    <div>This is a paragraph.</div>
    <br>
    <div>This is another paragraph.</div>
</body>
</html>  
Run it Yourself »