'Sweet Alert 2 without npm
My app isn't npm and I need to use Sweet Alert 2.
I looked for information on the site https://sweetalert2.github.io, but without success.
Is there any way to use Sweet Alert 2 without npm?
Regards, Felipe.
Solution 1:[1]
Just add cdn links in view:
<link href="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/7.33.1/sweetalert2.css" rel="stylesheet" type="text/css">
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/7.33.1/sweetalert2.js"></script>
Js code:
<script>
$(document).ready(function(){
Swal.fire({
type: 'success',
title: 'Your work has been done',
showConfirmButton: false,
timer: 1500
})
});
</script>
Solution 2:[2]
I found the answer, just use the tag below before all javascript imports to avoid errors:
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@8"></script>
Solution 3:[3]
you can grab it from jsdelivr CDN put below link in the head tag
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Natvarsinh Parmar - bapu |
| Solution 2 | Felipe Dominguesche |
| Solution 3 | Yvad60 |
