fadeOut() - fade out a visible element.


Syntax:

/*
speed - fast | slow | milliseconds
callback - optional 
*/
$(selector).fadeOut(speed,callback);

Example:

<!DOCTYPE html>
<html>
    <head>
        <title>jQuery Fading Methods</title>
        <style>
            div{
                background: green;
                padding: 10px;
                margin: 5px; 
            }
        </style>
    </head>
    <body>

        <button>Click to fade in</button><br><br>
        <div id="div1">div 1</div>
        <div id="div2">div 2</div>
        <div id="div3">div 3</div>


        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
        <script>
            $(document).ready(function() {
                $("button").click(function() {
                    $("#div1").fadeOut();
                    $("#div2").fadeOut("slow");
                    $("#div3").fadeOut(3000);
                });
            });
        </script>
    </body>
</html>