Jquery 如何在sweet alert中使用html标记 var text+='Hii这是错误'; swal(“必需”,文本,“错误”);

Jquery 如何在sweet alert中使用html标记 var text+='Hii这是错误'; swal(“必需”,文本,“错误”);,jquery,jquery-plugins,Jquery,Jquery Plugins,如何在Bootstrap Sweet alert插件中使用html编码 在上面的代码中,我必须为编写一条错误消息以显示在sweetalert中。但是当在文本变量中使用html标记时,它作为字符串, 相同的字符串可以显示在sweetalert中,但不能在html标记中转换。您必须添加html:true以显示html内容,如 var text += '<b>Hii This is Error<b>'; swal("Required", text, "error"); swa

如何在Bootstrap Sweet alert插件中使用html编码

在上面的代码中,我必须为编写一条错误消息以显示在sweetalert中。但是当在文本变量中使用html标记时,它作为字符串,
相同的字符串可以显示在sweetalert中,但不能在html标记中转换。

您必须添加
html:true
以显示html内容,如

var text += '<b>Hii This is Error<b>';
swal("Required", text, "error");
swal({
标题:“必选”,
文本:“Hii这是错误”,
html:true,//如果要显示html,请添加此项
类型:“错误”//类型可以是错误/警告/成功
});

阅读。

您必须添加
html:true
以显示html内容,如

var text += '<b>Hii This is Error<b>';
swal("Required", text, "error");
swal({
标题:“必选”,
文本:“Hii这是错误”,
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({
标题:“错误”,
文本:“Hii这是错误”,
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({
标题:“错误”,
文本:“Hii这是错误”,
html:对
});

swal({
标题:“必选”,
文本:“请填写必填字段”,
是的,
类型:“错误”
});
swal({
标题:“必选”,
文本:“请填写必填字段”,
是的,
类型:“错误”
});

在SweetAlert 2.0中,您不能使用html标记, 他们在报告中提到了这一点

通过我使用的SweetAlert 2.0实现这一点的方法是创建html并将其作为内容对象传递给swal或下面的示例

HTML内容

swal({
title: "Required",
text: "<b>Please fill the required fields</b>",
html: true,
type: "error"
});

在SweetAlert 2.0中,不能使用html标记, 他们在报告中提到了这一点

通过我使用的SweetAlert 2.0实现这一点的方法是创建html并将其作为内容对象传递给swal或下面的示例

HTML内容

swal({
title: "Required",
text: "<b>Please fill the required fields</b>",
html: true,
type: "error"
});

非常感谢。对于解决方案,如果有效!!然后,将其标记为答案,以便它可以帮助其他so用户。谢谢。。。对于解决方案,如果有效!!然后,将其标记为答案,以便帮助其他so用户。