Got a html page with a frequently changing part. That part is read by a script on the page:
<script>
console.log('In HTML');
fetch('changes/changes.html')
.then(data => data.text())
.then(html => document.getElementById('changes').innerHTML = html);
</script>
That works fine and makes publishing changes easy. However jQuery actions (in a separate script) on the read part don't work. The events are not triggered. How to fix that?
$(function () {
console.log('In script');
$('.change-card > .change-btn-action').on('click', function () {
console.log('Click event');
});
)};
The click event is never triggered. The log order is: In HTML, In script. Thanks for any help! Gerard