How to make text bold with sweetalert in 2018?

I saw that you could use the content option, but im not really sure how to go about that right now I have something like:

swal({title: 'hello', text: 'hello ${<strong>{name}</strong>}', icon: 'success' })

Answer

From the GitHub Issues, you should set a content and insert the text within it:

var name = "Stack Overflow";
var content = document.createElement('div');
    content.innerHTML = 'Hello <strong>'+ name +'</strong>';

    swal({
        title: 'Hello',
        content: content,
        icon: "success",
    })

Leave a Reply

Your email address will not be published. Required fields are marked *