sweet-alert display HTML code in text

前端 未结 11 1350
梦谈多话
梦谈多话 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:24

    All you have to do is enable the html variable to true.. I had same issue, all i had to do was html : true ,

        var hh = "test"; 
    swal({
            title: "" + txt + "", 
            text: "Testno  sporocilo za objekt " + hh + "",  
            html: true,  
            confirmButtonText: "V redu", 
            allowOutsideClick: "true"  
    });
    

    Note: html : "Testno sporocilo za objekt " + hh + "",
    may not work as html porperty is only use to active this feature by assign true / false value in the Sweetalert.
    this html : "Testno sporocilo za objekt " + hh + "", is used in SweetAlert2

提交回复
热议问题