Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

jQuery Hide DIV Elements After 5 Seconds or Some Time Delay

Aug 28, 2013
Introduction:

Here I will explain how to use 
jQuery to hide div elements after 5 seconds or jQuery show or hide div elements after 5 seconds or after some time delay or jQuery remove div after 5 seconds

To implement this we need to write the code like as shown below


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery Hide DIV Elements after 10 seconds</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript">
$(function() {
setTimeout(function() { $("#testdiv").fadeOut(1500); }, 5000)
$('#btnclick').click(function() {
$('#testdiv').show();
setTimeout(function() { $("#testdiv").fadeOut(1500); }, 5000)
})
})
</script>
<style type="text/css">
.content
{
border: 2px solid Red;
color: #008000;
padding: 10px;
width: 400px;
font-family:Calibri;
font-size:16pt
}
</style>
</head>
<body>
<input type="button" id="btnclick" value="Show DIV" />
<div class="content" id="testdiv" class="">
Hi, Welcome to Aspdotnet-Suresh.com
It will disappear in 4 seconds!
</div>
</body>
</html>
Live Demo

For live demo check below example


Hi, Welcome to Aspdotnet-Suresh.com It will disappear in 5 seconds!

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

7 comments :

Unknown said...

Sir Please Post any assignment on Shopping Cart.

ican said...

nice demo

Anonymous said...

dnt use set time out function never it is much time and heavy.. must use delay on that

budy said...

I got it...thnks

sheri said...

The time function is still heavy

Unknown said...

nice demo

Sradha WebCreations said...

hello sir how can i hide asp.net button for specific time range. like 6.00 P>M to 6.00 A.M

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 2015 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.