<!DOCTYPE html>
<html>
<head>
<script src="/lib/jquery-1.12.2.min.js"></script>
<script>
$(document).ready(function(){
        $("button").click(function(){
            $("p").fadeTo(2000, 0.2, function(){
                alert("The fadeTo effect is finished!");
            });
        });
});
</script>
</head>
<body>

<button>Gradually change the opacity of the p element</button>

<p>This is a paragraph.</p>

</body>
</html>