簡體   English   中英

在烤面包機的onShown事件中調用其他函數

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM