我想知道如何保持多選的不同值,然後從jQuery創建一個數組。保留選擇多個值並使用它們來創建表jQuery
讓我解釋一下,
我多選我有5個值:
<select name="animal" id="animal" multiple="multiple">
<option> value="30"> Cat </ option>
<option> value="31"> Dog </ option>
<option> value="32"> Bird </ option>
<option> value="33"> Cow </ option>
<option> value="34"> Fox </ option>
</ select>
我選擇示例值:30,32,34
,當我點擊我的「節目「按鈕,我想要它創建一個如下所示的表格:
<table>
<thead>
<tr>
<th>
Animal
</ th>
<th>
Cat
</ th>
<th>
Bird
</ th>
<th>
Fox
</ th>
</ tr>
</ thead>
<tbody>
</ tbody>
</ table>
如何使用jQuery 請 ?
我希望我已經解釋了我的問題。
謝謝你未來的答案。
@Kiranramchandran不要編輯代碼中的錯誤,否則原始的海報不會知道他做錯了什麼,現有的回答指出這些錯誤將不再有意義。 – RoToRa