【发布时间】:2021-05-21 11:41:12
【问题描述】:
Here is the link to a simple source code example 。我不知道我做错了什么,当我按下按钮时我似乎得到了回复,我可以证明它是因为通知代码。
这是一个最小的可重现代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" type="text/css" href="https://unpkg.com/notie/dist/notie.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/10.16.6/sweetalert2.css">
</head>
<body>
<div class="container">
<div class="row">
<div class="col">
<div><input type="submit" id="swale" class="btn btn-outline-danger" value="Make Registration"></div>
</div>
</div>
</div>
<script src="https://unpkg.com/notie"></script>
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script>
document.getElementById("swale").addEventListener("click", function(){
notify("This is a success message", "success")
notifyModal()
})
function notify(msg,msgType){
notie.alert({
type: msgType,
text: msg,
})
}
function notifyModal(){
swal.fire({
title: "title",
html: "<em> hello, world </em>",
icon: "success",
confirmButtonText: "wsd"
})
}
</script>
</body>
</html>
【问题讨论】:
-
请在问题中包含minimal reproducible example。
-
@SuperStormer 正如你所说,我已经改变了我的问题。
-
您的代码运行良好。 prnt.sc/138sa05
-
@Alaksander Jesus Gene 出于某种原因,该代码适用于 stackoverflow,但对我不起作用,请参阅 @prnt.sc/139qgzw。浏览器控制台显示此错误prnt.sc/139qlxq
标签: javascript html css notifications sweetalert2