t4t5 / sweetalert

A beautiful replacement for JavaScript's "alert"
https://sweetalert.js.org
MIT License
22.4k stars 2.85k forks source link

How can I use HTML in content #980

Closed LeoWang2007 closed 2 years ago

LeoWang2007 commented 2 years ago

This is my code

swal({
    icon: 'info',
    title: 'test',
    content: "it's<b>important</b>",
    footer: '&copy; WatermelonCloud',
    closeOnClickOutside: false,
    closeOnEsc: false
 })

I want to bold "important" but I got this image

lionralfs commented 2 years ago

You can do things like this:

var slider = document.createElement("input");
slider.type = "range";

swal({
  content: slider,
});

Feel free to check out the content section in the docs.