My html code is like this :
<button id="test-button-one">test button 1</button>
<div id="test"></div>
My javascript code is like this :
res = `<button id="test-button-two">test button 2</button`
$('#test-button-one').click(function(e){
$('#test').html(res);
});
$('#test-button-two').click(function(e){
alert('yeah')
});
Demo is like this :
https://jsfiddle.net/oscar11/qrdzf679/
If I click test button 1, it will display test button 2
Why when I click test button 2, it not display alert?
How can I solve it?