link: http://laude.vn/dat-ban.html
#---------------------------------------------------------------#
#### Code
<script type="text/javascript">
function addNewProduct()
{
var item_length = $('tr.product').length;
item_length = item_length + 1;
if ( item_length <= 15 ) {
//create new controls
var td1 = $(document.createElement('td'));
$(td1).append('<input name="product[]" type="text">');
var td3 = $(document.createElement('td'));
$(td3).append('<a href="javascript:void(0);" onclick="deleteProduct(' + item_length + ');"><i class="icon13"></i></a>');
var tr = $(document.createElement('tr'));
tr.attr('id', 'product' + item_length);
tr.attr('class', 'product');
// $(tr).append(td1, td2, td3);
$(tr).append(td1,td3);
$('tr#product' + (item_length-1)).after(tr);
}
}
function deleteProduct(num){
$('tr#product' + num).remove();
$('tr.product').each(function(index) {
if ( (index+1) >= num ) {
$('tr#product' + (index+2) + ' a').attr('onclick', 'deleteProduct(' + (index+1) + ');');
$(this).attr('id', 'product' + (index+1));
}
});
}
</script>
#### HTML
<table>
<tr id="product1" class="product">
<td>
<input name="product[]" type="text">
</td>
<td valign="middle" align="top">
<a href="javascript:void(0);" onclick="addNewProduct();" class="form-control"><i class="icon12"></i></a>
</td>
</tr>
</table>

