I have a problem with this code, the idea would be that when I click on the "submit" button, it shows me the data loaded in the form below
<!-- Formulario -->
<div class="formulario">
<h1> Tienda offline </h1>
<form name="cargar" method="get" action="cargar.html">
<p>Nombre:<input type="text" class="nombre"
name="producname"></p>
<p>Precio:<input type="text" class="precio" name="price"></p>
<p>ID:<input type="text" class="id" name="identify"></p>
<input type="submit" name="add" value="Añadir producto" class="boton1" id="addproducto" onclick="cargar">
<input type="submit" name="mod" value="Modificar producto" class="boton1"
id="modproducto">
</form>
</div>
<div id="java">
</div>
<script>
var nombre, identify, precio;
function cargar() {
var nombre = document.forms.cargar.producname.value;
identify = document.forms.cargar.identify.value;
precio = document.forms.cargar.price.value;
document.getElementById('java').innerHTML =
'
<div>
<p>$nombre;</p>
<p>$identify;</p>
<p>$precio;</p>
</div>
'
}
</script>
The idea would be to show me the values loaded on the same page