gpt4 book ai didi

javascript - 未捕获的语法错误 : missing ) after argument list throwing error in html line

转载 作者:行者123 更新时间:2023-11-30 20:27:39 24 4
gpt4 key购买 nike

谁能告诉我这一行有什么问题?

模板:

<c:forEach items="${templateList}" var ="temp">
<td>
<button onclick = "edit(${temp.id});" data-target="#myModal1" data-toggle="modal" title="Edit" class="btn btn-success btn-sm"><i class="fa fa-edit"></i>Edit</button>
</td>
<td>
<button data-target="#myModal2" title="Attach Link" data-toggle="modal" class="btn btn-success btn-sm"><i class="fa fa-paperclip"></i></button>
</td>
<td>
<button data-target="" data-toggle="modal" title="duplicate" class="btn btn-success btn-sm"><i class="fa fa-copy"></i></button>
</td>
</c:forEach>

还有这个功能

<script>
function edit(id){
$.get("get/" + id,function(result){
$("#myModal1").html(result);
alert("dnrbufevc ");
});
}
</script>

最佳答案

onClick 的模板更改为以下内容

<button onclick = "edit('${temp.id}')" data-target="#myModal1" data-toggle="modal" title="Edit" class="btn btn-success btn-sm"><i class="fa fa-edit"></i>Edit</button>

确保用单引号将 '${temp.id}' 括起来,以便 javascript 将其视为字符串文字。

关于javascript - 未捕获的语法错误 : missing ) after argument list throwing error in html line,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50711000/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com