我尝试使用Bootstrap 3中的模态功能来显示产品选项。当我使用console.log检查时,它在.js文件中工作,但它不能在HTML端工作。
这是我的代码:
HTML
<div id="moveProdModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-header">
<h3 id="myModalLabel" data-i18n="moveProducts">Move Products</h3>
</div>
<div class="modal-body"> <input id="mg"> <%= brands %></input>
<fieldset>
<label style="text-align:center;font-weight:bold" data-i18n="askBrand">Which Collection would you like to move the selected Digital Interaction to?</label>
<% if(brands){ %>
<select class="brand" id="brand" style="margin-left:107px;width:314px">
<% for(var i=0; i<brands.length; i++){ %>
<% if(i==0) {%>
<option value="<%= brands[i]._id %>" selected><%= brands[i].name %></option>
<% } else { %>
<option value="<%= brands[i]._id %>"><%= brands[i].name %></option>
<% } %>
<% } %>
</select>
<% } %>
<% } %>
<div style="border-style: dotted;color: rgb(241, 233, 233);margin-left:107px;margin-right:107px;padding-top:13px;padding-bottom:13px">
<label class="control-label"><span data-i18n="confirmMove1" style="color:red;padding-left:9px">Are you sure you would like to move this/these</span><label data-i18n="confirmMove2" style="color:red;text-align:center;">to the selected Collection?</label></label>
</div>
</fieldset>
</div>
<div class="modal-footer">
<button class="btn cancelDelete1 btn-danger customButton" data-dismiss="modal" aria-hidden="true" data-i18n="cancel">Cancel</button>
<button class="btn moveProduct btn-success customButton" data-id="single" data-i18n="move">Move</button>
</div>
</div>
JS代码: 我正在使用ajax调用来获取另一个函数的品牌,并且它正在获取。
"click #move-product":"loadModel2",
loadModel2: function(){
$('#moveProdModal').modal('show');
console.log(brands);
}