lundi 29 décembre 2014

using jQuery to find an href and print the domain name


I've got a site with hundreds of images that are linked to external websites.


I'm trying to work out a jQuery script that will find the hostname of the href link around each image and echo that domain name in a caption div below the image.


For instance, if an image is linked to http://amazon.com/someproducturl, I'd like to dynamically add a caption that says "Buy now from Amazon.com"





Aucun commentaire:

Enregistrer un commentaire