【发布时间】:2018-07-10 02:09:41
【问题描述】:
我正在尝试创建一个模式,它应该在我的代码中显示位置变量提及 这是我的 ejs 代码(我使用 ejs 和节点 js 以及模态的 java 脚本)
<div class="container-fluid">
<%for(i=0;i<Vac.length;i++){%>
<div class="alert alert-dark" role="alert">
<h4 class="alert-heading">Postion:- <%=Vac[i].position%></h4>
<hr>
<h5>Type:- <%=Vac[i].type%></h5>
<h6>Skills:- <%=Vac[i].Skills%></h6>
<p class="lead"><%=Vac[i].Description%> </p>
<button type="button" class="btn btn-primary" data-toggle="modal" onclick="showApply()">Apply</button>
<br>
</div>
<%}%>
</div>
这是我的模态javascript代码
<script>
function showApply()
{
$('#applyModal').modal('show');
$('#applyModal').('#applyModaltitle').text($('#alert-heading'));
}
</script>
但我收到如下错误:
SyntaxError: missing name after . operator[Learn More] careers:216:23 [Show/hide message details.] ReferenceError: showApply is not defined
谁能告诉我哪里出了问题,我该如何纠正?
【问题讨论】:
-
$('#applyModal').('#applyModaltitle')这不是有效的语法,你想在那里做什么? -
附加到CertainPerformance stackoverflow.com/questions/5736811/…
-
@CertainPerformance 我正在尝试从模态中的 Vac 数组中获取位置变量
标签: javascript node.js bootstrap-4 bootstrap-modal