I am looking to use Javascript or jQuery to pull the alt tag from the specific image that had been clicked in the HTML and copy its value into a caption field.
function change_image(diff){
var newAlt = $(this).attr('alt');
position = (position + diff + hrefs.length) % hrefs.length;
revealImage(hrefs[position]);
$nav.find('.counter').html(newAlt);
}
That is what I have so far and it does not work.