Javascript &引用;未捕获的语法错误:输入意外结束“;尝试将处理程序附加到事件时
我正在尝试将JQuery插件附加到JQuery模板。我已经大致弄明白了,除了为这个插件的Javascript &引用;未捕获的语法错误:输入意外结束“;尝试将处理程序附加到事件时,javascript,jquery,jquery-plugins,Javascript,Jquery,Jquery Plugins,我正在尝试将JQuery插件附加到JQuery模板。我已经大致弄明白了,除了为这个插件的confirm和cancel事件附加一个处理程序之外 该插件来自这里: 工作代码: <script id="buttonsTemplate" type="text/x-jquery-tmpl"> <div class="col-md-6"> <button type="button" id="enterInPTPButton" class="btn btn-p
confirm
和cancel
事件附加一个处理程序之外
该插件来自这里:
工作代码:
<script id="buttonsTemplate" type="text/x-jquery-tmpl">
<div class="col-md-6">
<button type="button" id="enterInPTPButton" class="btn btn-primary" style="border-radius: 0; margin-left:10px; border-color:#3C5B75;">Entered In PTP</button>
<button type="button" id=${'deleteEntryButton' + rowName} class="btn btn-warning confirm" style="border-radius: 0; margin-left:10px;">Delete Entry</button>
<button type="button" id="offboardedButtons" class="btn btn-info" style="border-radius: 0; margin-left:10px; border-color:#3A7B8E;">Offboarded</button>
</div>
<script type="text/javascript">
var rowName = "#deleteEntryButton";
rowName = ${rowName};
$(rowName).confirm({
text: "Are you sure you want to delete this entry?",
title: "Confirmation Required",
confirmButton: "Yes I am",
cancelButton: "No",
confirmButtonClass: "btn-danger",
cancelButtonClass: "btn-default"
});
{{html "</sc"+"ript>"}}
</script>
不过,这段代码似乎确实适用于静态元素。这是什么原因造成的?我能做些什么来解决这个问题
编辑:以下是控制台中的完整错误:
未捕获的语法错误:inputn.extend.globalEval意外结束@
jquery.js:328n.fn.extend.domManip@
js:5435jQuery.fn.extend.domManip@
jquery.tmpl.js:105n.fn.extend.append@
js:5218jQuery.fn.(匿名函数)@
jquery.tmpl.js:60FillTables@userCodeAppPanel:119(匿名函数)
@userCodeAppPanel:49ri@
348032839-mae_html_user_bin_i18n_mae_html_user.js:49(匿名)
函数)@348032839-mae_html_user_bin_i18n_mae_html_user.js:14Cj.v@
348032839-mae_html_user_bin_i18n_mae_html_user.js:75ph@
348032839-mae_html_user_bin_i18n_mae_html_user.js:30kh@
348032839-mae_html_user_bin_i18n_mae_html_user.js:31(匿名)
函数)@34803289-mae_html_user_bin_i18n_mae_html_user.js:28
你从哪里得到的错误?如果这是一个
意外的unput结束
错误,它应该会准确地告诉您控制台中出现此错误的原因,对吗?有,继续,并将其添加到我的帖子中。这看起来像是缺少结束大括号的问题:Uncaught SyntaxError:inputn.extend.globalEval@但哪里缺少大括号?我承认我的粘贴剪掉了大括号,但对于弯曲的括号,它们就在那里。试着用漂亮的打印机或节点检查文件的语法,你从哪里得到错误?如果这是一个意外的unput结束
错误,它应该会准确地告诉您控制台中出现此错误的原因,对吗?有,继续,并将其添加到我的帖子中。这看起来像是缺少结束大括号的问题:Uncaught SyntaxError:inputn.extend.globalEval@但哪里缺少大括号?我承认我的粘贴剪掉了大括号,但对于弯曲的括号,它们就在那里。试着使用漂亮的打印机或节点来检查文件的语法
<script id="buttonsTemplate" type="text/x-jquery-tmpl">
<div class="col-md-6">
<button type="button" id="enterInPTPButton" class="btn btn-primary" style="border-radius: 0; margin-left:10px; border-color:#3C5B75;">Entered In PTP</button>
<button type="button" id=${'deleteEntryButton' + rowName} class="btn btn-warning confirm" style="border-radius: 0; margin-left:10px;">Delete Entry</button>
<button type="button" id="offboardedButtons" class="btn btn-info" style="border-radius: 0; margin-left:10px; border-color:#3A7B8E;">Offboarded</button>
</div>
<script type="text/javascript">
var rowName = "#deleteEntryButton";
rowName = ${rowName};
$(rowName).confirm({
text: "Are you sure you want to delete this entry?",
title: "Confirmation Required",
confirm: function(button) {
DeleteEntry();
},
cancel: function(button) {
// nothing to do
},
confirmButton: "Yes I am",
cancelButton: "No",
confirmButtonClass: "btn-danger",
cancelButtonClass: "btn-default"
});
{{html "</sc"+"ript>"}}
</script>
confirm: function(button) {
DeleteEntry();
},
cancel: function(button) {
// nothing to do
},