The working form of the link is as: image #1 If I understand this correctly, it is defined in the js file here: var objCaption = document.createElement("span"); objCaption.setAttribute('id','caption'); objImageDetails.appendChild(objCaption); Which becomes: I'm trying to have the output something as: I also see this near the end, this is what's creating the span output? // if caption is not null if(imageArray[activeImage][1]){ Element.show('caption'); Element.setInnerHTML( 'caption', imageArray[activeImage][1]); }