var text += '<b>Hii This is Error<b>';
swal("Required", text, "error");
如何在Bootstrap Sweet alert插件中使用html编码。如何在甜蜜警报中使用html标记
在上面的代码我必须写为一个错误消息!在sweetalert中显示。但在文本变量中使用html标记时,它需要字符串 ,并且可以在sweetalert中显示相同的字符串,它不能在html标记中进行转换。
var text += '<b>Hii This is Error<b>';
swal("Required", text, "error");
如何在Bootstrap Sweet alert插件中使用html编码。如何在甜蜜警报中使用html标记
在上面的代码我必须写为一个错误消息!在sweetalert中显示。但在文本变量中使用html标记时,它需要字符串 ,并且可以在sweetalert中显示相同的字符串,它不能在html标记中进行转换。
您必须添加html:true
用于显示例如HTML内容,
swal({
title: "Required",
text: "<b>Hii This is Error<b>",
html: true, // add this if you want to show HTML
type: "error" // type can be error/warning/success
});
你应该试试这个
swal({
title: "Error",
text: '<b>Hii This is Error<b>',
html: true
});
swal({
title: "Required",
text: "<b>Please fill the required fields</b>",
html: true,
type: "error"
});
谢谢你......为解决 –
如果作品!然后,将其标记为答案,以便它可以帮助其他SO用户。 –