I have a function that adds some details to the DataTable, the function is activated by a button that is to add, then hide the modal. what I want is that the user has the option to continue adding details a button that adds the details to the table, clean the modal and do not hide it. here I leave part of my code because it is very extensive.
function agregarDetalle() {
var detalleCaptura = $('#detalleCaptura');
var componentes = $('#componentes').val();
var tiempoColecta = $('#tiempoColecta').val();
rowNum++;
var t = detalleCaptura.DataTable();
t.row.add([
'<a href="#myModal" id="editRow" class="btn btn-primary btn-sm" title="Editar" custom-modal="true" data-toggle="modal" data-backdrop="static" data-keyboard="false" onClick="editRow(' + rowNum + ')"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></a>' +
'<a class="btn btn-danger btn-sm" id="idEliminarFila' + rowNum + '" title="Eliminar" onClick="deleteRow(' + rowNum + ')"><i class="fa fa-trash-o" aria-hidden="true"></i></a>',
'<input type="hidden" id="componentes' + rowNum + '" name="datosCaptura[add][row' + rowNum + '][componentes]" value="' + componentes + '" /> <p id="pcomponentes' + rowNum + '">' + componentes + '</p>',
'<input type="hidden" id="tiempoColecta' + rowNum + '" name="datosCaptura[add][row' + rowNum + '][tiempoColecta]" value="' + tiempoColecta + '" /><p id="ptiempoColecta' + rowNum + '">' + tiempoColecta + '</p>' +
]).draw(false);
$('#myModal').modal("hide");
return false;
}
<button type="button" id="agregarDetalle" data-dismiss="alert" class="btn btn-flat btn-success btn-save-coupon-ref" onClick="agregarDetalle()"><span class="fa fa-save"></span>Agregar</button>
<button type="button" class="btn btn-flat btn-success btn-save-coupon-ref" onClick="guardarYcrearNueva()"><span class="fa fa-save"></span>Crear y agregar otro</button>
I would like the second function to run until before ("modal" .hide)