Quiero agregar elementos de un input a un array, pero cada vez que se hace push
, el array se reinicia y no se van agregando los elementos.
Cuando lo imprimo se muestra nuevamente como un nuevo array:
function busca() {
var _platillo = document.getElementById("platillo").value;
var _precio = document.getElementById("precio").value;
var tot=[]
tot.push(_platillo+_precio);
document.getElementById('resultado').value= tot;
};