<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<style>
.fonts {
border: 2px solid green;
color: green;
}
</style>
<script type="text/javascript">
$(function() {
//This setTimeout function execute or call automatically when 5 second completed.
setTimeout(function() {
$("#divShow").fadeOut(1500);
}, 5000);
$('#btnShow').click(function() {
//This is used for show the div.
$('#divShow').show();
//This setTimeout function execute when click on show div buton and hide automatically.
setTimeout(function() {
$("#divShow").fadeOut(1500);
}, 5000);
});
});
</script>
</head>
<body>
<div>
<input type="button" id="btnShow" value="Click for Show div" />
</div>
<div class="fonts" id="divShow">
<h2>Hi, Welcome you to code-sample.com.</h2> It will disappear in 5 seconds!
</div>
</body>
</html>
// Code goes here
/* Styles go here */