Skip to content

Commit d70169d

Browse files
authored
Added Search On Enter Functionality on GitHub Profile Finder App (#300)
> Here is the snapshot https://github.com/Git21221/JS-beginner-projects/assets/144181107/c4d3fdcf-baa8-4212-899e-856f6fc48f0c
2 parents 786fbdc + 90b9c8c commit d70169d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

GitHub Card/js/script.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ async function profile(name = "shouryasinghrathore") {
3434
}
3535
}
3636

37-
37+
function searchOnEnter() {
38+
document.getElementById("inputValue").addEventListener('keypress', (n) => {
39+
if (n.key === 'Enter') { processInput(); }
40+
})
41+
}
3842

3943
function processInput() {
4044
let inputValue = document.getElementById("inputValue").value;
@@ -46,4 +50,5 @@ function processInput() {
4650
}
4751
}
4852

49-
profile();
53+
profile();
54+
searchOnEnter();

0 commit comments

Comments
 (0)