Reputation: 973
I have the same question as this guy: Sweetalert - Call function in Javascript
With the answers given in that question I can not figure out the problem. I have downloaded the .js and .css files from http://tristanedwards.me/sweetalert. I have saved them in the same project as I am working in with my script. Then within my .html file I have added the following lines:
<script src="SweetAlert.js"></script>
<link href="SweetAlert.css" rel="stylesheet">
<body>
<button type="button" id="button1" onclick='sweetAlert("Oops...", "Something went wrong!" , "error")'>Title</button>
</body>
This works with the standard Alert() functionality. Why doesnt it work with sweetAlert? I am assuming multiple .js files could cause the problem since I call for 3 of them.
Upvotes: 1
Views: 2730
Reputation: 4516
I don't know if that's your problem but for me this following HTML is working. Put the files in the same folder, watch out for the file name, because the file name you wrote is diffrent than the one downloaded,
Also was missing close on the link "/>"
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="sweet-alert.js"></script>
<link href="sweet-alert.css" rel="stylesheet"/>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<button type="button" id="button1" onclick='sweetAlert("Oops...", "Something went wrong!" , "error")'>Title</button>
</body>
</html>
Upvotes: 2