Toastr js add aprove / disaprove button

Marc Rasmussen picture Marc Rasmussen · Jun 26, 2014 · Viewed 12.8k times · Source

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.

Answer

John Papa picture John Papa · Jul 9, 2014

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