[英]toastr javascript SyntaxError
i am tring to implement a toastr with yes or no buttons 我想用是或否按钮实现烤面包机
and i get this 我明白了
SyntaxError: missing ) after argument list
参数列表后出现SyntaxError:缺少)
this is my JavaScript Code: 这是我的JavaScript代码:
<script type="text/javascript">
function detele() {
toastr.warning("<div>confirmer la suppression?</div>" +
"<div class ='btn-group pull-right'> " +
"<button type ='button' id='confirmationYes' class ='btn btn-xs btn-primary'><i class='glyphicon glyphicon-ok'></i>Oui</button>" +
"<button type ='button' class ='btn btn-xs btn-default clear'><i class='glyphicon glyphicon-remove'></i>Non</button>" +
"</div>",
"DeleteConfirmation",
{
allowHtml: true,
closeButton: true,
onShown: function() {
$("#confirmationYes").click(function() {
toastr.success("Done");
});
}
});
};
</script>
the console shows that the error is in this line 控制台显示错误在这一行
"<div class="btn-group pull-right"> " +
i just dont get it !
我就是不明白!
You are missing a Parenthesis. 您缺少括号。
<script type="text/javascript">
function detele() {
toastr.warning("<div>confirmer la suppression?</div>" +
"<div class ='btn-group pull-right'> " +
"<button type ='button' id='confirmationYes' class ='btn btn-xs btn-primary'><i class='glyphicon glyphicon-ok'></i>Oui</button>" +
"<button type ='button' class ='btn btn-xs btn-default clear'><i class='glyphicon glyphicon-remove'></i>Non</button>" +
"</div>",
"DeleteConfirmation",
{
allowHtml: true,
closeButton: true,
onShown: function() {
$("#confirmationYes").click(function() {
toastr.success("Done");
});
}
};
)};
</script>
note that in yours, the .click(function() { doesn't have a closing parenthesis. Next time before posting, make sure you check that all the openings have closings. 请注意,您的.click(function(){没有右括号。下一次发布之前,请确保您检查所有开口是否都具有右括号。
You forget to close your delete and onShown function. 您忘记关闭删除和onShown功能。 try this code
试试这个代码
<script type="text/javascript">
function detele() {
toastr.warning("<div>confirmer la suppression?</div>" +
"<div class ='btn-group pull-right'> " +
"<button type ='button' id='confirmationYes' class ='btn btn-xs btn-primary'><i class='glyphicon glyphicon-ok'></i>Oui</button>" +
"<button type ='button' class ='btn btn-xs btn-default clear'><i class='glyphicon glyphicon-remove'></i>Non</button>" +
"</div>",
"DeleteConfirmation",
{
allowHtml: true,
closeButton: true,
onShown: function() {
$("#confirmationYes").click(function() {
toastr.success("Done");
});
};
});
};
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.