Yosh! In a popover, I added two links. The 1st refers to an action by the controller (And it works) The second contains a simple class, which, when clicked, should trigger launch a simple alert in JS. Except it doesn't work.
The popover header code in the DOM:
$(".show").click(function(){
var header = "<a class='btn btn-sm btn-primary js-alert'>Click on me</a>";
$(".show").popover({
title: header,
placement: 'top',
trigger: 'click',
content: "toto",
container: 'body',
html: true
}).popover('show');
});
$(".js-alert").click(function(){
alert("Hello !");
})
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
<div class="container mt-4">
<button type="button" class="btn btn-secondary show">Show popover</button>
</div>
And when I click on the second link, nothing happens at all (and no error)
This is an example on jsfiddle : https://jsfiddle.net/kiuega/ec3v1mfn/