ShapeYourPath
(current)
Run Code
Live Code Editor- Bootstrap 4 Toast
Source Code
<!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!-- Bootstrap CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"> <title>Bootstrap 4 Toast Example</title> </head> <body> <div class="container text-center mt-4"> <h1 class="text-center">Bootstrap Toast</h1> <p class="text-center"> In this example, you will learn how to create Bootstrap 4 toast. It is a small alert box that appears for a couple of seconds whenever the user clicks on any link. </p> <button type="button" class="btn btn-primary" id="buttonId">Click To See Toast Effect </button> <div class="toast"> <div class="toast-header"> <h3>Bootstrap Toast</h3> </div> <div class="toast-body"> <p class="text-justify"> Toast is a small alert box that will be visible for a couple of seconds whenever the user clicks on any link, button. </p> </div> </div> <!--/toast--> </div> <!--/container--> <!-- jQuery first, then Popper.js, then Bootstrap JS --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#buttonId").click(function() { $('.toast').toast('show'); }); }); </script> </body> </html>
Output :
Running