1

到目前为止的代码:

<!DOCTYPE html>
<html>
    <head>
        <title>Project 506</title>
        <script type="text/javascript" src="sweetalert.min.js"></script>
        <script src="https://ajax.googlesapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
        <link rel="stylesheet" href="sweetalert.css" type="text/css" />
        <style type="text/css">
            body {
                text-align: center;
            }
        </style>
        <script type="text/javascript">
            $(document).ready(function () {
                $("#first").click(function () {
                    sweetAlert("Oops...", "Something went wrong!", "error");
                });
            });
        </script>
    </head>
    <body>
        <h1>Message Boxes</h1>
        <input type="button" id="first" value="Just a Notification" />
        <input type="button" id="second" value="Successfully Completed!" />
        <input type="button" id="third" value="Something Went Wrong!" />
    </body>
</html>

我不清楚为什么当我点击第一个按钮时,sweetAlert 动画仍然没有弹出。我已经尝试将行移动<script>到脚本的不同部分,但它仍然不起作用。那么我该如何解决这个问题呢?

4

1 回答 1

0

检查你的 jQuery 网址。它应该是:

https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js

于 2015-08-09T11:48:30.500 回答