比方說,我有一個下拉列表(或組合框),它有一些事情的列表。一旦我從列表中選擇了一件事物,它就會自動添加到表格中。我會怎麼做?可能它只是HTML/JS?添加項到表 - HTML/CSS/JS
下拉:
<select class="combobox form-control" style="display: none;">
<option value="" selected="selected">Point Guard</option>
<option value="CP3">Chris Paul (93)</option>
</select>
表:
<table class="table">
<thead>
<tr>
<th>Position</th>
<th>First Name</th>
<th>Last Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Mark</td>
<td>Otto</td>
</tr>
<tr>
<td>2</td>
<td>Jacob</td>
<td>Thornton</td>
</tr>
<tr>
<td>3</td>
<td>Larry</td>
<td>the Bird</td>
</tr>
</tbody>
</table>
感謝。
您能否詳細說明您的情況? –
@JayeshGoyani一旦我從下拉菜單中選擇了該項目,該項目將被插入到表格中。你懂了?我將如何插入我選擇的項目,添加到表格中。 –
使用'.onchange'事件,然後創建一些HTML並將其附加到您的表中。 – tymeJV