正在试验节点Js。如何创建动态下拉菜单? 感谢。
答案 0 :(得分:6)
<div class="control-group">
<%- form.label("state_or_province", false, {class: "control-label"}) %>
<div class="controls">
<!-- <%- form.input("state_or_province") %> -->
<select id="Facility_state_or_province" name="Facility[state_or_province]" size="1">
<% state_or_province_list.forEach(function (state_or_province_entry) { %>
<option value = "<%= state_or_province_entry.lookup_code %>" <%= (facility.state_or_province != null) && (facility.state_or_province == state_or_province_entry.lookup_code) ? 'selected = "selected"' : '' %>><%= state_or_province_entry.meaning %></option>
<% }); %>
</select>
</div>
</div>