Search results

Action Buttons in JavaScript (ES5) Toast control

23 Mar 2023 / 1 minute to read

You can include action buttons to the toast control by adding the buttons property. The collection of Essential JS 2 button models can be bound to the model property inside the buttons property. You can also include the click event callback function for each button.

Copied to clipboard

//Initialize Toast component
var toast = new ej.notifications.Toast({
  title: 'Anjolie Stokes',
  content: 'Thanks for the update!',
  icon: 'e-laura',
  position: { X: "Right", Y: "Bottom" },
  width: 280,
  height: 120,
  buttons: [{
        model: { content: "Ignore" }, click: btnClick
    }, {
        model: { content: "reply" }
//Render initialized Toast component

document.getElementById('show_toast').onclick = function () {;

function btnClick(e) {
  var toastEle = ej.base.closest(, '.e-toast');
Copied to clipboard
<!DOCTYPE html><html lang="en"><head>
    <title>Essential JS 2 Toast</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Typescript Toolbar Controls">
    <meta name="author" content="Syncfusion">
    <link href="index.css" rel="stylesheet">
    <link href="//" rel="stylesheet">
.e-toast-icon.e-laura.e-icons {
    border-radius: 50%;
    background-repeat: no-repeat;
    background-size: cover;
    background-image: url(;
    height: 44px !important;
    margin: 0;
    width: 60px;
#elementToastTime .e-toast-message {
    padding: 10px;
</style><script src="" type="text/javascript"></script>

    <div id="container">
        <div class="row"> <button class="e-btn" id="show_toast"> Show Toast</button> </div>
        <div id="element"></div>
        <div id="elementToastTime"></div>
        <div id="result"></div>

var ele = document.getElementById('container');
if(ele) { = "visible";
<script src="index.js" type="text/javascript"></script>

See Also