From 268ea465afcb7c2244bd1dc004cf458e0669ffdc Mon Sep 17 00:00:00 2001 From: Kumar Priyansh Date: Mon, 31 Aug 2020 00:43:50 +0530 Subject: Enlarged search text and search event fired on enter press --- app/css/style.css | 2 +- app/scripts/search.js | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'app') diff --git a/app/css/style.css b/app/css/style.css index 3031eb2..d9ff071 100644 --- a/app/css/style.css +++ b/app/css/style.css @@ -26,7 +26,7 @@ body { .search { background: transparent; - font-size: 24px; + font-size: 3rem; border: none; color: #ffffff; outline: none; diff --git a/app/scripts/search.js b/app/scripts/search.js index 0b1f70f..d9fdc71 100644 --- a/app/scripts/search.js +++ b/app/scripts/search.js @@ -2,9 +2,11 @@ const searchBox = document.getElementById('searchBox'); const natural = require('natural'); const wordnet = new natural.WordNet(); -searchBox.addEventListener('keyup', () => { - const word = searchBox.value; - wordnet.lookup(word, details => { - console.log(details); - }); +searchBox.addEventListener('keypress', (e) => { + if (e.keyCode === 13) { + const word = searchBox.value; + wordnet.lookup(word, details => { + console.log(details); + }); + } }); -- cgit v1.2.3