Add something from form to array

PHOTO EMBED

Thu Oct 21 2021 16:23:15 GMT+0000 (Coordinated Universal Time)

Saved by @InsaneSuperSand #javascript #html

    <form onsubmit="return spieces()">
        <!---- <label for="fname">Nazwa przyprawy:</label><br>-->
        <input type="text" id="spiceName">
        <input type="submit" value="Submit">

    </form>

var spiceslist = [];

function spieces() {
  let boxvalue = document.getElementById("spiceName").value;
  spiceslist.push(boxvalue);
  console.log(spiceslist);
  return false;
}

content_copyCOPY