[英]call other function in toaster onShown event
我有以下代碼用於烤面包機
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
});
}
});
我外面有一個職能
hidepanel(){
}
嘗試在烤面包機內的onShown方法中調用時會引發錯誤
hidepanel在“ HTMLElement”類型上不存在。
這怎么工作?
謝謝
假設您有一個函數調用hidepanel
,請使用=>
表達式
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();
});
}
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.