CodeSeven / toastr

Simple javascript toast notifications
http://www.toastrjs.com
MIT License
11.96k stars 2.04k forks source link

I want to get the custom parameter when onclick #650

Open itren9 opened 4 years ago

itren9 commented 4 years ago

Hello, I want to get the custom parameter when onclick, the parameter is hidden, not shown in the page, can you implement it?How to do that

vanilla-thunder commented 4 years ago

try overriding the onclick event

$.extend(
  toastr.options,
  {
    tapToDismiss: true,
    timeOut: 0,
    extendedTimeOut: 0,
    onclick: function() { alert("default callback") }
  }
);

toastr.info("info");
toastr.success('success',null,{
    onclick: function() { 
    alert("you clicked on success");
  }
});
toastr.error('error',null,{
    onclick: function() { 
    alert("you clicked on error");
  }
});
toastr.warning('warning',null,{
    onclick: function() { 
    alert("you clicked on warning");
  }
});