I have the html code to create a ticket or sales invoice. And I want to add all the checks that are desired as a form of payment. For this I have a new check button that dynamically loads a form with the data of it and a button to register. But the problem is if I click more than once another form appears indefinitely. The idea is that until a check is loaded that does not appear another form, I mean one at a time.
<div class="row">
<a id="nuevocheque" class="btn btn-primary">
<span class="glyphicon glyphicon-new"></span>Nuevo Cheque
</a>
</div>
<div id="datoscheque"></div>
And in factura.js:
$("#nuevocheque").click(function(){
var formcheque='<div class="row"><label class="col-sm-2 control-
label">BANCO</label><div class="col-sm-4">'+'<select id="bancos"><option
value"=0">Seleccione<option></select></div>'+'<label class="col-sm-2 control-
label">CUENTA N°</label>'+'<div class="col-sm-4">'+'<input type="text"
class="form-control" id="nrocuenta" placeholder="Cuenta
Bancaria"/>'+'</div>'+'<label class="col-sm-2 control-
label">Titular</label>'+'<div class="col-sm-4">'+'<input type="text"
class="form-control" id="titular" placeholder="Titular"/>'+'</div>'+' <label
class="col-sm-2 control-label">Fecha de Cobro</label>'+'<div class="col-sm-
4">'+'<input type="text" class="form-control" id="fechacobro"
placeholder="Deposito el:"/>'+'</div>'+'<label class="col-sm-2 control-
label">Importe</label>'+'<div class="col-sm-4">'+'<input type="text"
class="form-control" id="Importe" placeholder="Son pesos"/>'+'</div>'+'<div
class="row"> <a id="acreditar" class="btn btn-primary">'+'<span
class="glyphicon glyphicon-ok"></span>Ingresar al pago</a></div></div>';
$(formcheque).appendTo("#datoscheque");
listarbancos();
$("#acreditar").click(function(){
var Importe=$("#Importe").val();
$("#cheques").val(Importe);
});
});
How can I do it?