OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How do I program my alert to disappear after 3 seconds?

  • Thread starter Thread starter khev
  • Start date Start date
K

khev

Guest
So I have this alert but I have no idea how to program it in such a way that it will automatically disappear after 3 seconds. I am a beginner and I really am struggling with this. I am using reactJS. Here is the link of what it looks like incase anyone wants to see it.

This is my alert

Code:
 <div class="alert alert-success" id="alertDiv" role="alert" style={{ fontSize: 20 }}>
    <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
    <strong>Success!</strong> You have been signed in successfully!
 </div>

<p>So I have this alert but I have no idea how to program it in such a way that it will automatically disappear after 3 seconds. I am a beginner and I really am struggling with this. I am using reactJS. <a href="https://i.sstatic.net/LQTyI.png" rel="nofollow noreferrer">Here is the link of what it looks like incase anyone wants to see it.</a></p>
<p>This is my alert</p>
<pre><code> <div class="alert alert-success" id="alertDiv" role="alert" style={{ fontSize: 20 }}>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<strong>Success!</strong> You have been signed in successfully!
</div>

</code></pre>
 

Online statistics

Members online
0
Guests online
3
Total visitors
3
Top