0
當我嘗試使用值輸入的克隆錶行時,它複製但輸入了鬆散值。如何克隆具有值的錶行。當克隆jQuery時鬆動輸入值
<table class="table table-bordered table-striped">
<tr>
<th>Service</th>
<th>Price</th>
<th>Quantity</th>
<th> </th>
</tr>
<tr class="tr_clone">
<td><input type="text" ></td>
<td><span class="controls">
<input value="100000" class="placeholder span2 datepicker" type="text" value="" data-date-format="yyyy-mm-dd">
</span></td>
<td><span class="controls">
<input class="placeholder span2 datepicker" type="text" value="" data-date-format="yyyy-mm-dd">
</span></td>
<td> </td>
</tr>
</table>
<p><a href="#" class="tr_clone_add">Clone</a></p>
$(function(){
$(".tr_clone_add").live('click', function() {
var $tr = $('table').find('.tr_clone').first();
var $clone = $tr.clone();
$clone.find(':text').val('');
$tr.after($clone);
});
});
你知道你的價值明確設置爲空字符串的行? – adeneo