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
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
Description:
In previous articles I explained jQuery Show hide div elements, jQuery settimeout function example, jQuery slideUp slideDown slideToggle effects example, jQuery Enable / Disable Textbox Controls on WebPage, jQuery Show Hover Dropdown Menu, Simple jQuery modal popup example, jQuery show YouTube videos in popup window and many articles relating to JQuery, JavaScript. Now I will explain how to hide div elements after 5 seconds using jQuery.
In previous articles I explained jQuery Show hide div elements, jQuery settimeout function example, jQuery slideUp slideDown slideToggle effects example, jQuery Enable / Disable Textbox Controls on WebPage, jQuery Show Hover Dropdown Menu, Simple jQuery modal popup example, jQuery show YouTube videos in popup window and many articles relating to JQuery, JavaScript. Now I will explain how to hide div elements after 5 seconds using jQuery.
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. |
|||
|
|||
7 comments :
Sir Please Post any assignment on Shopping Cart.
nice demo
dnt use set time out function never it is much time and heavy.. must use delay on that
I got it...thnks
The time function is still heavy
nice demo
hello sir how can i hide asp.net button for specific time range. like 6.00 P>M to 6.00 A.M
Note: Only a member of this blog may post a comment.