Sapan Diwakar

Software developer

Follow me on Twitter Check out my code on GitHub View some of my designs on Dribbble Take a look at my Linked In profile

jQuery click on image div

I was recently working with jQuery and Image slideshow (for which I used Awkward Showcase plugin). I needed to click on the image but my click function was not working which I found very strange. So, finally I arrived at the following solution on "How to respond to user click on a div with image in it".

On finding more about it, I found that the problem was that awkward slider was dynamically removing and adding the content to my page. From jQuery API Docs:

live() method provides a means to attach delegated event handlers to the document element of a page, which simplifies the use of event handlers when content is dynamically added to a page.