Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Toastr js add aprove / disaprove button

I am trying to setup Toastr js to become sortof a dialog button.

All i need is an "Approve" and a "Disaprove" button on my Toastr message

toastr.options = {
    "closeButton": true,
    "debug": false,
    "positionClass": "toast-bottom-left",
    "onclick": null,
    "showDuration": "1000",
    "hideDuration": "1000",
    "timeOut": "5000",
    "extendedTimeOut": "1000",
    "showEasing": "swing",
    "hideEasing": "linear",
    "showMethod": "fadeIn",
    "hideMethod": "fadeOut"
}
toastr.info("Do you wish to continue");

Does anyone know if that is possible or know any other script that allows me to?

Please note

I know this can be done with Modal but i want to try and avoid it.

like image 372
Marc Rasmussen Avatar asked Sep 02 '25 16:09

Marc Rasmussen


2 Answers

Sure. You can add any HTML you want to the toast then hook up event handlers to it. See the demo for more details and examples. http://codeseven.github.io/toastr/demo.html

like image 181
John Papa Avatar answered Sep 06 '25 21:09

John Papa


You can add buttons for toastr js.

For example a button for ok is clicked to clear the toastr:

toastr.info('message <button type="button" class="btn clear btn-toastr" onclick="toastr.clear()">OK</button>' , 'Studio Message:');
like image 40
Adi Ep Avatar answered Sep 06 '25 21:09

Adi Ep