Intento hacer que desde un modal con una tabla se pueda mandar una fila hacia otra tabla.
Aquí esta lo que llevo avanzado. https://jsfiddle.net/eddyzezb/
Sin embargo, aunque manda la fila a otra tabla no regresa a su tabla original al ser eliminada. Y me gustaría saber lo que me falta para realizarlo.
Gracias de antemano.
JS Jquery 2.1.0:
$('table>tbody>tr>td>.a').one('click',function(){
$(".othertable").append("<tr><td>"+
$(this).closest('tr').children()[0].textContent+"</td><td><input type='text' placeholder='Ingresar cantidad'/></td><td>"+
$(this).closest('tr').children()[1].textContent+"</td><td><input type='button' class='btneli' value='Eliminar'></td></tr>");
$(this).parent().parent().remove();
$('tr .btneli').one('click',function(){
$('.btneli').parent().remove();
});
});
HTML:
<div class="row">
<div class="col-xs-12 col-md-12">
<table class="table table-condensed table-hover table-bordered">
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Accion</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<td>Doe</td>
<td><button class="a">Aqui</button></td>
</tr>
<tr>
<td>Sam</td>
<td>Smith</td>
<td><button class="a">Aqui</button></td>
</tr>
</tbody>
</table>
</div>
</div>
<table class="othertable table-condensed table-hover table-bordered">
<thead>
<tr>
<th>Firstname</th>
<th>Precio</th>
<th>Lastname</th>
<th>Accion</th>
</tr>
</thead>
<tbody>
</tbody>
</table>