I need help with adding buttons dynamically - while the first button works, the others do not. I used to utilize the live
function, but it was removed in jQuery 1.9.1. How can I make sure that newly added buttons also work as intended?
HTML Snippet:
<div class="take">
<p>This is a paragraph</p>
<button class="test">Copy</button>
</div>
jQuery Snippet:
$('.test').on('click', function() {
var parentElement = $(this).parent();
new.clone().insertAfter(parentElement);
})
Check out the jsfiddle link for more information.