After two callbacks, js cannot get the declared value in the trigger event.

these are two events popup passes cb into the popupHide event

$("body").on("tap", ".removeNumber", function () {
    var _this = $(this);
    api.popup("title", "center", function () {
      console.log(_this);
      //deleteCard(_this)
    })
  });
Nov.04,2021

there is a problem onclick= "popupHide ('+ cb +')" .
explain in detail: cb is a function reference, and string concatenation implicitly calls cb.toString () , and popupHide ( and ) string is probably popupHide (function () {console.log (_ this)}) . After binding to onclick and triggering the event, popupHide points to the global popupHide , and function () {console.log (_ this)} is the newly declared anonymous function, where _ this is indeed undefined .
solution: the onclick event registers the click event through $(.). On ('click', function () {.} after the HTML fragment is inserted into the DOM.
Note: it is best not to try to save cb to global variables, because you have to clean up cb after popup, otherwise memory leaks will occur.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bdbbda-312bc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bdbbda-312bc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?