Reputation: 22652
I have a jQuery script for adding dynamic content inside containerDivs. http://jsfiddle.net/Lijo/srFkJ/2/
This div element structure is added in multiple places in the HTML page. Please click First and Second buttons in the fiddle to see this.
The dynamic script adds a button named “View Recipients” to the HTML. When any of the “View Recipients” button is clicked, a new Div element (childHTML in fiddle code) need to be added to the corresponding logRow div (yellow background). How can we do this?
Upvotes: 0
Views: 166
Reputation: 129792
You can add a live listener to the .viewRecipientsButton
, which will trigger even for buttons that didn't exist when the listener was added
$('.viewRecipientsButton').live('click', function() {
$(this).closest('.logRow').append($(childHTML));
});
Note that live
is deprecated these days, but since you're including jQuery 1.4.1 in your document, I suppose this is a requirement.
Upvotes: 2