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用戶。 –