Text Links Trapped, But Not Image Links
I have an image wrapped inside a link tag.
- <a href="somepage.html"><img id="content" src="img/some.gif" /></a>
I want this
.click target to be the link:
- $('a').click(function(e){
Instead, the target returned is the image [HTMLImageElement].
I have tried using
closest() and
currentTarget:
- var url = (e.target).closest('a').href;
- var url = (e.currentTarget).closest('a').href;
- var url = (e.currentTarget).href;
But they all still return the image, not the link. Any suggestions?