I have problems with the following code I want to append some elements (now for example: buttons; later: this will be input fields) and click on them to do something.
The appending is ok, but by clicking on the new elements (buttons), JQuery doesn't do anything.
In use is jquery-3.3.1.
For example some snippets:
html - before .append
:
...
<div class="button">Button</div>
<div class="placeholder"></div>
...
JQuery:
...
$( ".button" ).on("click",function() {
$('.placeholder').append('<div class="button">Button</div>');
});
...
HTML after .append
:
...
<div class="button">Button</div>
<div class="placeholder">
<div class="button">Button</div>
</div>
...