我想知道是否有人可以帮助我编写一些代码。
我在某些模态窗口中使用 BootBox,我想向确认方法添加一些自定义 HTML,但我认为我做得不对。
我的代码如下:
$('.next').click(function (event) {
event.preventDefault();
var href = $(this).attr('href');
bootbox.confirm({
message: "I am a testing message",
title: "Please confirm you have enrolled"
callback: function (result) {
if (result) {
location.href = href;
}
}
});
});
我得到的错误如下:
Uncaught SyntaxError: Unexpected identifier
任何帮助将不胜感激。
干杯,
最佳答案
这里有一个语法错误:
您的原始代码
title: "Please confirm you have enrolled"
callback: function (result) {
if (result) {
location.href = href;
}
}
新代码
title: "Please confirm you have enrolled",
callback: function (result) {
if (result) {
location.href = href;
}
}
请注意 title
行末尾的“,”字符。
关于jquery - BootBox - 意外的标识符错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27054127/