From 048c964405d1f27ec315e5ae7738d11ac9c624cd Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Fri, 10 May 2019 13:23:30 -0600 Subject: [PATCH] Clear and refocus word form after add --- src/js/wordManagement.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/js/wordManagement.js b/src/js/wordManagement.js index d288199..47a9a11 100644 --- a/src/js/wordManagement.js +++ b/src/js/wordManagement.js @@ -64,9 +64,20 @@ export function submitWordForm() { if (validateWord(word)) { addWord(word); + clearWordForm(); } } +export function clearWordForm() { + document.getElementById('wordName').value = ''; + document.getElementById('wordPronunciation').value = ''; + document.getElementById('wordPartOfSpeech').value = ''; + document.getElementById('wordDefinition').value = ''; + document.getElementById('wordDetails').value = ''; + + document.getElementById('wordName').focus(); +} + export function addWord(word, render = true) { window.currentDictionary.words.push(word); addMessage('Word Created Successfully');