I am new to JavaScript and I need a JavaScript code that will change the image src to "next.png" when someone clicks the element with class "fancybox-close". Unfortunately, I can't do it simply by adding an "onclick" event to the "a" tag because the HTML code bellow is generated by JQuery and that's unknown for me. I have inspected this HTML by Firebug and so the class "fancybox-close" is the only thing I can use.
The HTML of element where I want to change the SRC (this I can change). The SRC of the image has been previously changed by other JavaScript code where I was able to use onclick (opening of the photo gallery) - that works. Now I want to change it again under different circumstates as explained above.
<img src="" alt="Next button" name="nextbutton" class="buttonimage" />
Code of the gallery that I can't change (inspected with Firebug):
<a class="fancybox-item fancybox-close" href="javascript:;" title="Close">
My JavaScript. I don't know how to attach document.getElementsByClassName to the document.images.XXX.src in order to make the code working.
var close = document.getElementsByClassName("fancybox-close").onclick;
document.images.nextbutton.src = "../../images/next.png";
Thank you.