I'm trying to copy a row of a table with jquery, this is the table:
<table id="myTable" class="table table-bordered">
<thead>
<tr>
<td>Empleado</td>
<td>Fecha salida</td>
<td>Fecha regreso</td>
</tr>
</thead>
<tbody>
<tr>
<td>
<select class="selectpicker" name="employee">';
buildemployees();
echo '</select>
</td>
<td><input type="text" class="form-control datepicker" name="dateI"></td>
<td><input type="text" class="form-control datepicker" name="dateO"></td>
</tr>
</tbody>
The problem is with the dropdown that is built based on a php function buildemployees (), since I tried to add a new one or cope it but it does not work for me, this is the jquery code I use right now:
var tbody = $(\'#myTable\').children(\'tbody\');
var table = tbody.length ? tbody : $(\'#myTable\');
$(\'.addPlus\').click(function(){
$("#myTable tbody td").clone().appendTo("#myTable tbody");
})
$(\'.addMinus\').click(function(){
$(\'#myTable\').each(function(){
$(\'#myTable\').find(\'tbody tr\').last().remove();
});
})