Sometimes we need to display some alert or dive after some period on Web page.
We can do this by using setTimeout method as below:
<html>
<head>
<title>Demo to show div</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(function(){
setTimeout(function(){
$("#alertMessage").show();
}, 2000);
});
</script>
<style>
.hideMessage{display:none;}
</style>
</head>
<body>
<div id="alertMessage" class="hideMessage"> This is alert message. </div>
</body>
</html>
Hope this will help you:)
0 Comment(s)