Skip to content

Commit

Permalink
fix autoocomplete related issues
Browse files Browse the repository at this point in the history
  • Loading branch information
suriyan committed Jan 8, 2024
1 parent 3594431 commit f20a9cd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions softwarecite/front/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@

// Add an event listener to each search input
inputs.forEach(function (input) {
input.addEventListener('keydown', function (event) {
input.addEventListener('keyup', function (event) {
if (event.key === 'Enter' || event.keyCode === 13) {
event.preventDefault();
if (input.value != "") {
Expand All @@ -129,7 +129,6 @@
}
});
});
var name; // global variable that keeps the name
// Select all of the elements
const elements = document.querySelectorAll('#autocomplete')
// Attach autocomplete to each element
Expand All @@ -147,7 +146,8 @@
})
},
onSubmit: result => {
name = result; //pass clicked result to global
var url = "{% url 'package_view' name='example' %}".replace('example', encodeURIComponent(result));
window.location.href = url;
}
})
})
Expand Down

0 comments on commit f20a9cd

Please sign in to comment.