Good. with this code I can add and remove rows but I am having difficulty locking the first one so it is not deleted. how can I do it?
var table = $( '#table-data' )[0];
$( table ).delegate( '.tr_clone_add', 'click', function () {
var thisRow = $( this ).closest( 'tr' )[0];
$( thisRow ).clone().insertAfter( thisRow ).find( 'input:text' ).val( '' );
});
$(table).delegate( '.tr_clone_del', 'click', function () {
var thisRow = $(this).closest("tr")[0];
thisRow.remove();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><tablewidth="100%" border="0" cellspacing="0" cellpadding="0" id="table-data">
<tr>
<td>header1</td>
<td>header2</td>
<td> </td>
<td> </td>
</tr>
<tr class="tr_clone">
<td>
<select name="campo1[]">
<option value="0">-</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
</td>
<td><input type="text" name="campo2[]" class="input" value="0"></td>
<td><button alt="" class="tr_clone_add" style="cursor:pointer;" title="Adicionar">+</button></td>
<td><button alt="" class="tr_clone_del" style="cursor:pointer;" title="Remover">-</button>
</td>
</tr>
</table>