Hide Div After Some Time Using Jquery
In this tutorial, I will explain how to hide div after some time using jquery
Description:
In previous articles, I explained Change Text Box Background Color On Focus & Blur Using JQuery, Get Latitude and Longitude from Zip Code using Jquery, What is Local Storage and Session Storage and many more articles relating to Angular, Node, React & JavaScript. Now I will explain how to hide div after some time using jQuery
We need to use setTimeout function which calls a function or executes a code snippet after a specified delay.
Use The Code:
<script type="text/javascript"> setTimeout(function() { $("#divRegister").fadeOut(1500); }, 2000): </script>
If you want to complete code, you need to write the code like as shown below
Use The Code:
<html> <head> <title>Hide div after some time</title> <script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.min.js"></script> <script type="text/javascript"> $(document).ready(function () { setTimeout(function () { $('#divRegister').fadeOut(1500); }, 2000); }); </script> </head> <body> <div id=divRegister> Register Here </div> </body> </html>
For Your Referance Link