I am injecting some HTML with ajax into my page but the onclick handler on a part of that injected HTML doesn’t seem to work…
basically this image…
< img class="close_row" src="img/close.gif"/>
my jquery goes like…
$('.close_row').click(function() {
// some code to close the row
});
the original function to open the row and inject the html works fine, am i overlooking something here?
Use
.delegate()instead.delegate()was introduced to overcomelive()‘s shortcomings andlive()would have been completely removed if it wasn’t for the fact that it would have broken a lot of code.Differences between
live()anddelegate(): http://net.tutsplus.com/tutorials/javascript-ajax/quick-tip-the-difference-between-live-and-delegate/API: http://api.jquery.com/delegate/