I'm trying to use jquery and click() to grab the url of an image link once its clicked. The html looks like this.
<div class="lp-element lp-pom-image" id="lp-pom-image-167" >
<a href="http://url.com/page" target=""><img src="/image.jpg" alt=""></a>
</div>
The javascript I'm using so far looks like this but it isn't grabbing the url of the clicked image link. The url needs to be passed to where the variable this
is.
jQuery(function() {
jQuery("#lp-pom-image-167").click(function() {
trackOutboundLink(this, 'AddToCart', 'Bottom CTA');
return false;
});
});
How do I pull the href url with the appropriate base URI? ie. "http://url.com/page"?
EDIT:clarified what i am trying to pull out.