I am currently working on implementing a notifications feature using bootstrap popover. The issue I am facing is that after a user clicks on a notification, it should be removed. However, for some reason, it requires two clicks to actually remove the notification - nothing happens on the first click. I have confirmed that the click listener is firing by using alert() statements.
To simplify the problem, I have created a basic example in this js fiddle: https://jsfiddle.net/ksun78/758n1azu/36/
$('body').on("click", ".popover-body .notif-popup-container", function() {
$("#" + $(this).attr("id")).remove();
})
I have included the code snippet above as it is required, but the main issue can be seen in the provided fiddle link.
If anyone has an idea of what might be causing this issue and how to fix it, I would greatly appreciate your help. Thank you!