I am trying to find the image inside parent div’s sideblings with Jquery. I wonder what’s the best and fast way to find it.
html
more divs..and all generated dynamically..
<div>
other dynamically generated image...
<img src='haha1.jpg' />
<img src='haha2.jpg' />
</div>
<div>div 2</div>
<div>div 3</div>
<div>div 4</div>
<div>div 5</div>
more divs....
<div>
<button id='btn'/>
</div>
$('#btn').click(function(){
//I have to change image source by using parent() method....
})
Thanks for the help!
If your button can have an
ID…jQuery: