Sweet Alert Message in HTML
<!DOCTYPE html>
<html>
<head>
<title>SweetAlert Example</title>
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
</head>
<body>
<button onclick="showSweetAlert()">Click me</button>
<script>
function showSweetAlert() {
swal({
title: "Are you sure?",
text: "Do you want to continue?",
icon: "warning",
buttons: ["Cancel", "OK"],
}).then((value) => {
if (value) {
swal("Great!", "You pressed OK!", "success");
} else {
swal("Cancelled", "You pressed Cancel!", "error");
}
});
}
</script>
</body>
</html>
Comments
Post a Comment