paritybit.ca

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 5f59b10ff2d196f3aaa08e3e530496f9e880cf28
parent 70a29368d3870682bbcb429471c6bb533f7a4664
Author: Jake Bauer <jbauer@paritybit.ca>
Date:   Mon, 15 Apr 2019 02:17:39 -0400

Clear input fields when adding

Diffstat:
Mpublic/js/initiative.js | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/public/js/initiative.js b/public/js/initiative.js @@ -50,8 +50,12 @@ function draw(char, position) { function addChar() { let newChar = {}; - newChar.name = document.getElementById("char-name").value; - newChar.initiative = Number(document.getElementById("init-val").value); + nameField = document.getElementById("char-name"); + initField = document.getElementById("init-val"); + newChar.name = nameField.value; + newChar.initiative = Number(initField.value); + nameField.value = null; + initField.value = null; if (newChar.name == "" || newChar.initiative == null) { alert("Please fill out both fields before adding a character."); return;