Estoy haciendo una calculadora en tiempo real pero necesito que el resultado se imprima dentro de una etiqueta <p>
o similar.
Mi código es el siguiente:
document.getElementById("tb").addEventListener("input", function() {
var precio2;
var cantidad2;
var total2;
precio2 = document.getElementById('precio1').value;
cantidad2 = document.getElementById('cantidad').value;
total2 = precio2 * cantidad2;
document.getElementById('total1').value = total2;
});
<input type="number" class="form-control mb-2" name="cantidad" id="cantidad" placeholder="C/Personas" min="1" max="{{$invitation->cantidad}}" required>
<input type='hidden' name='precio1' id='precio1' value='{{$invitation->dias->c_entrada}}' style='color: black; background: transparent; border: 0; text-align: center;' readonly>
<!-- AQUI ME GUSTARIA IMPRIMIR EL RESULTADO DE LA MULTIPLICACION -->
<div class="text-center"> Total: $ <div name="total1" id="total1"></div> </div>