Ryan Christian
Ryan Christian

Reputation: 59

Sweet Alert Not Working

I want to integrate sweetalert with my project. but I'm having the following error

This Is Javascript Error Screenshot

I've been looking for solutions to this problem quite a long time, but I still can not solve it

this is my html code

<link href="/vendors/sweetalert/sweetalert.css" rel="stylesheet">
<script src="/vendors/jquery/dist/jquery.min.js"></script>
        <script src="/vendors/sweetalert/sweetalert-dev.js"></script>
    <script type="text/javascript">
        sweetAlert("a", "b", "error");
    </script>

I had time to find a similar problem, by replacing swalto swalAlerttheir problem successfully repaired, but not with my problem

please help me. thx..

Upvotes: 2

Views: 9014

Answers (1)

user9263373
user9263373

Reputation: 1074

Your code works for me using the CDN links. Check your console to make sure you're not getting a 404 error when referencing the css or js files. Also, I'm linking to version 2. Is that what version you're using locally?

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/7.11.0/sweetalert2.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/7.11.0/sweetalert2.all.min.js"></script>

<script type="text/javascript">
  sweetAlert("a", "b", "error");
</script>

Upvotes: 2

Related Questions