From de938483ac3299685e798139a622a07d34778022 Mon Sep 17 00:00:00 2001 From: Kumar Priyansh Date: Mon, 31 Aug 2020 00:57:08 +0530 Subject: update results --- app/css/style.css | 3 ++- app/scripts/search.js | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/css/style.css b/app/css/style.css index f8c53d9..8070c1c 100644 --- a/app/css/style.css +++ b/app/css/style.css @@ -43,7 +43,8 @@ body { } .results { - margin-top: 50px; height: 50%; overflow-y: scroll; + width: 80%; + margin: 50px auto 0px auto; } diff --git a/app/scripts/search.js b/app/scripts/search.js index d9fdc71..e7146fb 100644 --- a/app/scripts/search.js +++ b/app/scripts/search.js @@ -1,4 +1,5 @@ const searchBox = document.getElementById('searchBox'); +const results = document.getElementById('results'); const natural = require('natural'); const wordnet = new natural.WordNet(); @@ -7,6 +8,12 @@ searchBox.addEventListener('keypress', (e) => { const word = searchBox.value; wordnet.lookup(word, details => { console.log(details); + details.forEach(detail => { + const definition = document.createElement('p'); + definition.innerHTML = detail.def; + definition.className = 'definition'; + results.appendChild(definition); + }); }); } }); -- cgit v1.2.3