Skip to content

Commit

Permalink
added event listener that detects when the enter button is pressed an…
Browse files Browse the repository at this point in the history
…d triggers the click evet
  • Loading branch information
oanapintoiu committed Aug 28, 2024
1 parent 271783a commit 04c2608
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ document.addEventListener("DOMContentLoaded", async () => {
const searchButton = document.getElementById("search-button");
const searchInput = document.getElementById("search-input");


searchInput,addEventListener("keydown", (event) => {
if (event.key === "Enter") {
searchButton.click();
}
})

searchButton.addEventListener("click", async () => {
clearFields();
try {
Expand Down

0 comments on commit 04c2608

Please sign in to comment.