I'm trying to hyperlink an image within this array... Having some trouble
Here is my code: var images = [ 'images/gustav-klimt.jpg', 'images/woman-looking-forward.jpeg', 'images/snowy-landscape.jpg' ]; var num = 0; function next() { var slider = document.getElementById('slider'); num++; if(num >= images.length) { num = 0; } slider.src = images[num]; } function prev() { var slider = document.getElementById('slider'); num--; if(num < 0) { num = images.length-1; } slider.src = images[num]; } The slider functions well, but I want the images to be hyperlinked too. I've googled everywhere and havent found an applicable solution. I thought this would work: var images = [ '<a href='#'><img src='images/gustav-klimt.jpg'/></a> ]; but still no luck..