Sweet alert message disappears very quickly

1

By clicking on the button, the SweetAlert window appears with the message, but it disappears immediately and does not allow the user to read the alert.

Script:

<script type="Text/javascript">
    function Notificacion2() {
        swal({
            type: 'error',
            title: 'La contraseña es incorrecta',
            showConfirmButton: false
        })
    }
</script>

    
asked by Gdm96 22.01.2018 в 16:39
source

1 answer

3

Use the parameter " timer: " which allows to define the time it will take to disappear the alert.

<script type="Text/javascript">
        function Notificacion2() {
            swal({
                type: 'error',
                title: 'La contraseña es incorrecta',
                showConfirmButton: false,
                timer: 3000 // es ms (mili-segundos)
            })
        }
    </script>
  

This works from Sweetalert 2

    
answered by 22.01.2018 / 16:45
source