Whats wrong with my code for .addEventListener
Html code:
Don't Give Up
Home
TAKE ACTION
Fighters
a:link {
color: Blue;
background-color: transparent;
text-decoration: none;
}
a:visited {
color: Purple;
background-color: transparent;
text-decoration: border;
}
a:hover {
color: black;
background-color: transparent;
text-decoration: underline;
}
a:active {
color: Blue;
background-color: transparent;
text-decoration: underline;
}
Extra Facts
Click Me
Java code:
var factList = [
"Mo", /*0*/
"ok", /*1*/
"oh", /*2*/
"shh"]; /*3*/
var fact = document.getElementById("fact");
var wind = document.getElementById('wind');
var count = 0;
wind.addEventListener('click', displayfact());
function displayfact(){
fact.innerHTML = factList[count];
count++;
if (count == factList.length){
count = 0;
}
}