我试图从引导模型传递数据并将其显示在表上。但是,这里的问题是我无法传递数据,而列只显示空值。我是新手,所以我需要一些关于如何传递数据日和会话的帮助?从引导模型传递数据
<table class="table order-list" id="myTable">
<thead>
<tr>
<th>
Day
</th>
<th>
Type
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div id="daypicker" class="modal-body">
<div class="container">
<h5>Select A Day: </h5>
<select class="selectpicker" data-style="btn-info" multiple data-max-options="1" data-live-search="true">
<optgroup label="Day">
<option>Monday</option>
<option>Tuesday</option>
</optgroup>
</select>
<h5>Select A Session: </h5>
<select class="selectpicker" data-style="btn-info" multiple data-max-options="1" data-live-search="true">
<optgroup label="Session">
<option>Morning</option>
</optgroup>
</select>
</br>
</br>
</div>
</div>
</br>
</br>
</br>
<div class="modal-footer">
<button id="addrow" type="button" class="btn btn-primary">Add</a>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
var counter = 0;
$("#addrow").on("click", function() {
var newRow = $("<tr>");
var cols = "";
cols += '<td><input type="text" class="form-control" name="Day' + counter + '"/></td>';
cols += '<td><input type="text" class="form-control" name="Session' + counter + '"/></td>';
newRow.append(cols);
$("table.order-list").append(newRow);
counter++;
});
});
</script>
你离开了按钮来添加行 – j08691
<按钮ID = “addrow” 类型= “按钮” 类= “BTN BTN-主”>添加 – stackoverflownewbie
它已经存在,我只需要知道如何传递值附加新行 – stackoverflownewbie