The code I provided should work.
The fact that it doesn’t is more likely due to the way your HTML is structured.
What speaks against letting me see the page?
The code I provided should work.
The fact that it doesn’t is more likely due to the way your HTML is structured.
What speaks against letting me see the page?
Hi,
I had a look at the page and got to the bottom of it.
The problem was threefold.
$(document).ready()
callback. The reason that nothing was showing for the final image is that you had included the script before it was rendered on the page (thus you couldn’t access it in the DOM).I PM’d you a link to a working example.
I hope this helps.
Thanks, it worked
No probs.
You can also extract the caption like this:
var caption = $("img").attr('src').match(/(\\w+)\\.\\w+[^/]*$/)[1];
This will match the file name, irrespective of the file ending.