I have a button
which is dynamically added on the page (via mustache).
There is a class on it.
But when I click on this button, the JQuery
method is not executed.
My HTML:
<div id="layout"></div>
My HTML with the dynamically added button:
<div id="layout">
<a href="#" class="hello">Hello</a>
</div>
My jQuery:
$(function(){
$('.hello').on('click', function(e){
e.preventDefault();
console.log('Hello');
});
});