aboutsummaryrefslogtreecommitdiff
path: root/app/scripts
diff options
context:
space:
mode:
authorKumar Priyansh <[email protected]>2020-08-31 00:43:50 +0530
committerKumar Priyansh <[email protected]>2020-08-31 00:43:50 +0530
commit268ea465afcb7c2244bd1dc004cf458e0669ffdc (patch)
tree4a1aeb6d581c962dccd20cf5a567981ef6de5a11 /app/scripts
parentc88c3a21fcb0cfb1aa3e24eb1d4b6d5556e29e3c (diff)
downloaddictionary-268ea465afcb7c2244bd1dc004cf458e0669ffdc.tar.xz
dictionary-268ea465afcb7c2244bd1dc004cf458e0669ffdc.zip
Enlarged search text and search event fired on enter press
Diffstat (limited to 'app/scripts')
-rw-r--r--app/scripts/search.js12
1 files changed, 7 insertions, 5 deletions
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);
+ });
+ }
});