【发布时间】:2021-05-02 22:23:51
【问题描述】:
如果我使用本地存储单击"<span onclick='save()'>Don't Show Again</span>",,我一直在尝试隐藏此消息,但它不起作用。我该怎么做?
<script type="text/javascript">
if(localStorage.getItem("DontShow")) {
$("#save").hide();
}
$(document).on("click", "#save", function() {
localStorage.setItem("DontShow", "true");
});
Swal.fire({
allowOutsideClick: false,
allowEscapeKey: false,
allowEnterKey: false,
showCancelButton: true,
icon: 'info',
title: 'Title',
html: '<div class="swal-left"><b>Text</b><br>Text</div>',
confirmButtonColor: '#DD6B55',
cancelButtonText: "Close",
confirmButtonText: "<span onclick='save()'>Don't Show Again</span>",
footer: '<a href>Why do I have this issue?</a>'
});
</script>
【问题讨论】: