sweet-alert display HTML code in text

前端 未结 11 1348
梦谈多话
梦谈多话 2020-12-24 01:52

I am using sweet-alert plugin to display an alert. With a classical config (defaults), everything goes OK. But when I want to add a HTML tag into the TEXT, it display

11条回答
  •  盖世英雄少女心
    2020-12-24 02:26

    I was upgrading from old sweetalert and found out how to do it in the new Version (official Docs):

    // this is a Node object    
    var span = document.createElement("span");
    span.innerHTML = "Testno  sporocilo za objekt test";
    
    swal({
        title: "" + txt + "", 
        content: span,
        confirmButtonText: "V redu", 
        allowOutsideClick: "true" 
    });
    

提交回复
热议问题