🎨 Choosing a suggestion don't reload the page anymore

This commit is contained in:
Florian Sylvain
2021-10-31 12:43:08 +01:00
parent 69d9b45985
commit 76c6f9026c
2 changed files with 8 additions and 9 deletions
+7 -4
View File
@@ -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)
})
})
}
+1 -5
View File
@@ -115,11 +115,7 @@ body {
padding: 10px;
margin: 5px;
border-radius: 10px;
}
#suggestions a {
color: inherit;
text-decoration: none;
cursor: pointer;
}
#suggestions p:hover {