Reputation: 4596
I have below code to for toaster
toastr.success("<br /><br /><button type='button' id='confirmationRevertYes' class='btn clear'>Yes</button>",'delete item?',
{
closeButton: false,
allowHtml: true,
onShown: function (toast) {
$("#confirmationRevertYes").click(function(){
hidepanel(); // not working
this.hidepanel(); // not working
});
}
});
I have one function outside
hidepanel(){
}
When trying to call inside toaster onShown method it throws error
hidepanel does not exist on type 'HTMLElement'.
How can this work?
Thanks
Upvotes: 0
Views: 994
Reputation: 41387
Assuming you have a function call hidepanel
, use the =>
expression
toastr.success("<br /><br /><button type='button' id='confirmationRevertYes' class='btn clear'>Yes</button>",'delete item?',
{
closeButton: false,
allowHtml: true,
onShown: (toast) => {
$("#confirmationRevertYes").click(() =>{
this.hidepanel();
});
}
});
Upvotes: 2