To simplify from my actual code, lets say I have this:
<!-- Dynamic ajax content created after DOM load -->
<div id="dynamicUnknownIdName">lots of content <img src='image.jpg'>
</div>
<div id="edit_dynamicUnknownIdName" class="edit">Click Me</div>
Then, I set up my listener:
$(document).on('click', '.edit', function () {
var pieces = this.id.split('_');
var action = pieces[0];
var id = pieces[1];
if (action === 'edit') {
var content = $('#' + id).html();
}
});
My problem deals with getting the content of the ajax generated div. Every question I seem to find when I google for this is how to fire the click event on the action button, which you can see is not the problem. The DOM is not recognizing the div whose html I want, and the unrecognized div is unassociated with the binding action event.
Given this scenario, how would I make this work? Thanks!