diff options
| -rw-r--r-- | app/css/style.css | 3 | ||||
| -rw-r--r-- | app/scripts/search.js | 7 |
2 files changed, 9 insertions, 1 deletions
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); + }); }); } }); |
