Search code examples
sweetalert2

How to add more html to sweetalert after html to content update?


I saw previously you could edit the html portion of the sweetalert, but now that has been changed to content instead of doing raw html. Is there a way to go back to using html or another way of adding in an input. I saw in another post that it may be better to just use a modal instead.

https://github.com/sweetalert2/sweetalert2/issues/451 here is the guide with the html.


Solution

  • You are using SweetAlert2.

    The plain HTML option still exists. This is used as follows:

    swal({
        title: 'Title',
        html: 'A custom <span style="color: #F8BB86">html<span> message.'
    });
    

    Javascript Sweet Alert and html link inside text