input - Jquery Duplicate complete table, changing attributes -
i got html table
<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>
and i'd want generate table, without inputs, values. example:
<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>
indeed want summarize inputs values in "clean" table.
my problem correct input arrays , display of this.
try this,fiddle
$(function(){ var clone_table = $('#item-list').clone(); $(clone_table).addclass('cloneklass'); $('body').append(clone_table); $('.cloneklass input').each(function(){ $(this).replacewith(this.value); }) })
Comments
Post a Comment