<div class="form-group">
<h3 style="margin-left:20px;">Coberturas</h3>
<label class="col-sm-3 control-label">Marcar/Desmarcar Todos</label>
<div class="col-sm-1"><input type="checkbox" onclick="marcar(this);" class="form-control m-b"></div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Continuacion de Viaje</label>
<div class="col-sm-1"><input type="checkbox" name="Coberturas1" value="ROT (Volcadura) 10% Riesgos ordinarios de transito 5% Robo total 20% Huelgas y alborotos populares 5%" class="form-control m-b" checked></div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">No Continuacion de Viaje</label>
<div class="col-sm-1"><input type="checkbox" name="Coberturas2" value="Riesgos ordinarios de transito (Cobertura Basica) 5% Robo total con violencia y/o asalto 20% Robo parcial con violencia y/o asalto 20% Rapiña, arteria, pillaje y hurto a consecuencia de un riesgo ordinario de transito20% Mojadura y Oxidacion 5%" class="form-control m-b noCont"></div>
<div class="col-sm-1"><input type="checkbox" name="Coberturas3" value="Contaminacion y Manchas por contacto con otras cargas 5% Rotura y Rajadura 5% Merma 5% Derrame 5% Bodega a bodega 5% Maniobras a bodega 5% Fallas en el sistema de refrigeracion y calefaccion 5%" class="form-control m-b noCont"></div>
<div class="col-sm-1"><input type="checkbox" name="Coberturas4" value="Maniobras de carga y descarga 5% Estadia en recintos fiscales y fiscalizados por 30 dias 5% Barredura 5% Echazon 5% Barateria del capitan y la tripulacion 5% Huelgas y alborotos populares 5% ROT (Volcadura) 10%" class="form-control m-b noCont"></div>
</div>
I need to move the text of several span
so that they conform value
to those input
that precede them. I also need to be able to operate with them, as shown in the code. I have some functions created that are in charge of the mathematical operations but input
they are empty.
<form id="nclientes" name="nclientes" method="post" action="" class="form-horizontal">
<div class="form-group">
<label class="col-sm-2 control-label">Importe Asegurado</label>
<div class="col-sm-2"><input id="valor" type="number" onkeyUp="calcular();" name="importe" class="form-control m-b"></div>
</div>
<div id="span.derecha"class="form-group">
<label class="col-sm-2 control-label">Cuota Base (%)</label>
<div class="col-sm-2"><input id="valor2" type="text" onkeyUp="calcular();" name="cuota" class="form-control m-b"></div>
<label class="col-sm-2 control-label">Prima Neta</label>
<div class="col-sm-2"><input type="text" name="prima" class="form-control m-b"><span id="result" type="text" name="prima"></span></div>
<label class="col-sm-2 control-label">IVA (16%)</label>
<div class="col-sm-2"><input type="text" name="iva" class="form-control m-b"><span id="resultado3" type="text" name="iva"></span><br></div>
<label class="col-sm-2 control-label">Total</label>
<div class="col-sm-2"><input type="text" name="total" class="form-control m-b"><span id="total" type="text" name="total"></span></div>
</div>
<div class="form-group">
<div class="col-sm-4 col-sm-offset-5">
<button class="btn btn-primary" type="submit">Generar certificado</button>
</div>
</div>
</form>
With the help of a user I have reached this script that I attach in the image
The script doesn't work as I need, but I don't see the fault in it.
To solve your problem, what I would do is add a
id
to yourinput
, since you are adding the data insidespan
from JS.that means you can add them directly to your inputs too, if it works for you to display the results next to the input, leave them
span
alone if not just assign aid
to your input and insert the data directly there.development taken from Emerita's answer
I hope it helps
I have modified my code so that it works with what you request. Try it and tell me, regarding this code, what fails you or what you need.
By the way, in forms, the method must be capitalized. This is what it
method="post"
should bemethod="POST"
. Try to modify the value of the inputs, which takes them from the span set by me and you tell me if it is what you need.