diff --git a/ProjetProgWeb/app.js b/ProjetProgWeb/app.js index 076a02c..9a9a5d1 100644 --- a/ProjetProgWeb/app.js +++ b/ProjetProgWeb/app.js @@ -68,12 +68,15 @@ function realTimeDisplay() { .then(function(data) { suggestions.innerHTML = "" data.forEach(elem => { - let outsideTag = document.createElement('a') - outsideTag.href = "index.php?author=" + elem let name = document.createElement('p') name.innerHTML = elem - outsideTag.appendChild(name) - suggestions.appendChild(outsideTag) + name.addEventListener('click', () => { + document.querySelector('#results-count').innerHTML = "" + document.querySelector('#results').innerHTML = "" + searchBar.value = elem + requestToApi(elem) + }) + suggestions.appendChild(name) }) }) } diff --git a/ProjetProgWeb/stylesheet.css b/ProjetProgWeb/stylesheet.css index 0caf8c4..a3619ce 100644 --- a/ProjetProgWeb/stylesheet.css +++ b/ProjetProgWeb/stylesheet.css @@ -115,11 +115,7 @@ body { padding: 10px; margin: 5px; border-radius: 10px; -} - -#suggestions a { - color: inherit; - text-decoration: none; + cursor: pointer; } #suggestions p:hover {