diff options
| author | Kumar Priyansh <[email protected]> | 2020-08-31 00:57:08 +0530 |
|---|---|---|
| committer | Kumar Priyansh <[email protected]> | 2020-08-31 00:57:08 +0530 |
| commit | de938483ac3299685e798139a622a07d34778022 (patch) | |
| tree | 1ebc81eca9297b0d34f86569e39af653f99cb52e /app/scripts/search.js | |
| parent | e99a01c645b8faf88bc92bf63a0aec88a7d5b2d3 (diff) | |
| download | dictionary-de938483ac3299685e798139a622a07d34778022.tar.xz dictionary-de938483ac3299685e798139a622a07d34778022.zip | |
update results
Diffstat (limited to 'app/scripts/search.js')
| -rw-r--r-- | app/scripts/search.js | 7 |
1 files changed, 7 insertions, 0 deletions
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); + }); }); } }); |
