sweet-alert display HTML code in text

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

    A feature to allow HTML for title and text parameters has been added with a recent merge into the master branch on GitHub https://github.com/t4t5/sweetalert/commit/9c3bcc5cb75e598d6faaa37353ecd84937770f3d

    Simply use JSON configuration and set 'html' to true, eg:

    swal({ html:true, title:'TITLE', text:'TEXT'});
    

    This was merged less than a week ago and is hinted at in the README.md (html is set to false in one of the examples although not explicitly described) however it is not yet documented on the marketing page http://tristanedwards.me/sweetalert

提交回复
热议问题