@@ 15,12 15,14 @@ tagSelector.addEventListener("keyup", function(event) {
return response.json();
})
.then(function (data) {
- var t = "";
- for (var i=0; i < data.length; i++) {
- t += '<p class="tag-suggested">' + data[i].Name + '</p>';
+ if (data.length > 0) {
+ var t = "";
+ for (var i=0; i < data.length; i++) {
+ t += '<p class="tag-suggested">' + data[i].Name + '</p>';
+ }
+ autocompleteTags.innerHTML = t;
+ autocompleteTags.classList.remove("d-none");
}
- autocompleteTags.innerHTML = t;
- autocompleteTags.classList.remove("d-none");
})
.catch(function (error) {
console.log("Fetch error:", error);