Sweetalert2: How to close modal with html inside swal declaration?

Created on 9 Jun 2015  路  3Comments  路  Source: sweetalert2/sweetalert2

Hi,
I want to use html link to close sweet alert 2 modal alert. it is possible?

I have something like this

swal({
title: 'Product added to cart!',
html: 'I want more Checkout ',
timer: 10000,
showConfirmButton: false
});

So when someone click into I want more button the modal should close. Thanks in advance!

Most helpful comment

Sure it is :)

swal({
  title: 'Product added to cart!',
  html: '<a href="#" onclick="swal.closeModal(); return false;">I want more Checkout</a>',
  timer: 10000,
  showConfirmButton: false
});

All 3 comments

Sure it is :)

swal({
  title: 'Product added to cart!',
  html: '<a href="#" onclick="swal.closeModal(); return false;">I want more Checkout</a>',
  timer: 10000,
  showConfirmButton: false
});

Super fast answer! Super thanks!

BTW. SWAL2 is fare more better than SWAL... I can use smarty strings inside declaration too!
{l s='Some text'} or variables like {$product->name|escape:'htmlall':'UTF-8'}

Superb!

Glad it works for your projects! :+1:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

integrateddigital picture integrateddigital  路  4Comments

Hydro8 picture Hydro8  路  3Comments

gouhary picture gouhary  路  3Comments

smachs picture smachs  路  3Comments

samturrell picture samturrell  路  3Comments