jQuery .on()


jQuery .on()

예시

<button id='button-add'>버튼 추가</button>

<script src="//code.jquery.com/jquery.min.js"></script>
<script>
$('#button-add').click(function() {
  $('body').append("<button class='new-button'>새 버튼</button>");
});
$(document).on('click', '.new-button', function() {
  $(this).remove();
});
</script>

같이 보기