I'm trying here to get the previous "img" tag when clicking on the 3rd "i" tag :
<div>
<img src="img/image1.jpg" alt="image2"/>
<div id="image_options">
<i class="material-icons md-36">account_box</i>
<label>djbaptou</label>
<div id="left_icons">
<i class="material-icons md-36 fav">favorite_border</i>
<i class="material-icons md-36 purple">question_answer</i>
<i class="material-icons md-36 full_screen">settings_overscan</i>
</div>
</div>
</div>
Here is my jQuery code :
$(".full_screen").click(function(){
var img = $(this).parent().parent().closest("img");
modal.css("display", "block");
modalImg.attr("src", img.attr("src"));
});
But when i do a "alert(img);" it says that this is undefined
Any ideas ?
Aucun commentaire:
Enregistrer un commentaire