$('#btn').click(function(){ var newBtn = $('<button/>').text('호옹이').addClass('btnbtn'); $('#container').append(newBtn); }); $(document).on('click', '.btnbtn', function(){ alert('호에에에?'); }); $('#btn2').click(function(){ var newBtn = $('<button/>').text('호옹이2').addClass('btnbtn2'); $('#container').append(newBtn); }); $('.btnbtn2').on('click', function(){ alert('호엥?'); });
<button id="btn">버튼</button> <button id="btn2">버튼2</button> <div id="container"> </div>