Jquery Redirect to image src or data-attr

On a image inside link instead of use link href i would like to use img src to redirect to image path.

with this is possible to get the img src but how to use src to redirect? thank's

 $(".drop a").click( function() {

<div class="drop">
<a href""><img src=".." /></a>

Answers 1

  • Just use window.location


    $(".drop a").click( function() {
         window.location = $(this).children('img').attr('src');
         return false;

Related Articles