<div class="row">
<div class="col-md-6">
<button type="button" class="btn btn-primary" id="autoshowToast">Automatic Dismissal after 3 second</button>
<div id="toast1" class="toast" data-bs-autohide="true" data-bs-delay="3000">
<div class="toast-header">
<strong class="me-auto">Notification</strong>
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"> </button>
</div>
<div class="toast-body">
This toast will disappear after 3 seconds!
</div>
</div>
</div>
<div class="col-md-6">
<button type="button" class="btn btn-primary" id="manualshowToast">Automatic Dismissal after 5 second</button>
<div id="toast2" class="toast" data-bs-autohide="true">
<div class="toast-header">
<strong class="me-auto">Notification</strong>
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"> </button>
</div>
<div class="toast-body">
This toast will disappear after 3 seconds!
</div>
</div>
</div>
</div>
<script>
document.getElementById('autoshowToast').addEventListener('click', function () {
const toastEl = document.querySelector('#toast1');
const toast = new bootstrap.Toast(toastEl);
toast.show();
});
document.getElementById('manualshowToast').addEventListener('click', function () {
const toastEl = document.querySelector('#toast2');
const toast = new bootstrap.Toast(toastEl, { autohide: true, delay: 5000 });
toast.show();
});
</script>