Example prevent close modal when click outside modal SweetAlert

closeOnClickOutside : Decide whether the user should be able to dismiss the modal by clicking outside of it, or not.

Default: closeOnClickOutside: true



<!DOCTYPE html>



        <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>

        <p>Example Alert use closeOnClickOutside</p>


        <button onclick="run()">Run</button>


            function run() {

             swal("Can't close modal when click outside modal",{

                closeOnClickOutside: false,










Now you click outside modal can't close