mardi 7 avril 2015

javascript link isn't working on click; function works when page loads


var randomNumber

// generate the random numbers based on the length of the image array
randomNumber = Math.floor(Math.random() * topImages.length);

function shuffleTop(){
document.getElementById("topImage").src = topImages[randomNumber];
};

$("p a#shuffle").click(shuffleTop());


This is my link in my source code:



<p><a href="#" id="shuffle">SHUFFLE</a></p>




Aucun commentaire:

Enregistrer un commentaire