Jquery复制完整表,更改属性
我得到了这个html表格Jquery复制完整表,更改属性,jquery,input,html-table,arr,Jquery,Input,Html Table,Arr,我得到了这个html表格 <table id="item-list" class="table table-hover table-striped"> <thead> <tr> <th>Item</th> <th width="20%">Nombre</th> <th width="20%">Prix (T
<table id="item-list" class="table table-hover table-striped">
<thead>
<tr>
<th>Item</th>
<th width="20%">Nombre</th>
<th width="20%">Prix (TTC)</th>
<th width="20%" class="actions">Total</th>
<th></th>
</tr>
</thead>
<tbody>
<tr class="order-item">
<td><input name="name[1]" type="hidden" class="m-wrap small refrech-calc" value="cardv2">cardv2</td>
<td><input name="number[1]" type="text" class="m-wrap small refrech-calc" value="15"></td>
<td><input name="price[1]" type="text" class="m-wrap small refrech-calc" value="42"></td>
<td><span class="order-amount">630.00</span> €</td>
<td><button class="btn red mini deleteRowButton"><i class="icon-remove icon-white"></i></button></td>
</tr>
<tr class="order-item">
<td><input name="name[2]" type="hidden" class="refrech-calc" value="cardv2-5">cardv2-5</td>
<td><input name="number[2]" type="text" class="refrech-calc" value="20"></td>
<td><input name="price[2]" type="text" class="refrech-calc" value="45"></td>
<td><span class="order-amount">900.00</span> €</td>
</tr>
<tr class="order-item">
<td><input name="name[3]" type="hidden" class="refrech-calc" value="asuspx800">Asus px800</td>
<td><input name="number[3]" type="text" class="refrech-calc" value="1"></td>
<td><input name="price[3]" type="text" class="refrech-calc" value="260"></td>
<td><span class="order-amount">260.00</span> €</td>
<td><button class="btn red mini deleteRowButton"><i class="icon-remove icon-white"></i></button></td>
</tr>
</tbody>
</table>
项目
名义
大奖赛(TTC)
全部的
cardv2
630.00 €
cardv2-5
900.00 €
华硕px800
260.00 €
我想生成另一个表,没有输入,但是有它们的值。
例如:
...
(名称[1]值)
(编号[1])
价格[1]
630.00 €
名称[2]
编号[2]
价格[2]
900.00 €
等
实际上,我想在另一个“干净”表中总结我的输入值
我的问题是获取正确的输入数组并显示所有这些内容。尝试类似的方法
<table id="item-list" class="table table-hover table-striped">
...
<tbody>
<tr class="order-item">
<td>(name[1] values)</td>
<td>(number[1])</td>
<td>price[1]</td>
<td><span class="order-amount">630.00</span> €</td>
</tr>
<tr class="order-item">
<td>name[2]</td>
<td>number[2]</td>
<td>price[2]</td>
<td><span class="order-amount">900.00</span> €</td>
</tr>
....etc
</tbody>
</table>
$(function(){
var clone_table = $('#item-list').clone();
$(clone_table).addClass('cloneKlass');
$('body').append(clone_table);
$('.cloneKlass input').each(function(){
$(this).replaceWith(this.value);
})
})