jQuery clearTimeout isn't working?
-
05-07-2021 - |
質問
I am trying to clear this timeout so it restarts when this button has been clicked, however it isn't working :\
var confirmAlbumDelete;
$("body").on("click", ".upload-result-wrapper .top-details .delete", function(){
clearTimeout(confirmAlbumDelete);
$this = $(this);
$this.text("Yes, Delete Album").addClass("confirm-delete");
confirmAblumDelete = setTimeout(function(){$this.text("Delete Album").removeClass("confirm-delete")},10000);
});
解決
You misspelled the variable name:
confirmAblumDelete = setTimeout
^^
所属していません StackOverflow