$ (function() {
var avengers = [
"Black Widow",
"Captain America",
"Iron Man",
"Thor",
"Hulk",
"Scarlet Witch"
];
document.getElementById('searchBar').onkeyup = searchDropDown;
function searchDropDown(){
var input = document.getElementById("searchBar").value.toLowerCase();
for (var i = 0; i < avengers.length; i++) {
if (avengers[i].toLowerCase().includes(input)) {
alert("Success! Avengers Assemble!")
}
}
}
});
I'm encountering some issues with my JavaScript code. I'm attempting to create a search bar with a dropdown list similar to Facebook's search feature.
Would appreciate any assistance or guidance in the right direction. Thanks! :)