在链接内部的图像上而不是使用链接href我想使用img src重定向到图像路径。
有可能获得IMG SRC,但是如何使用SRC重定向?谢谢
$(".drop a").click( function() {
alert($(this).children('img').attr('src'));
});
<div class="drop">
<a href""><img src=".." /></a>
</div>
只需使用 window.location
代码: -
$(".drop a").click( function() {
window.location = $(this).children('img').attr('src');
return false;
});