2
私のJQueryに問題がありますが、削除ボタンが機能しない理由がわかりません。事前にJquery - .remove()に関するいくつかの問題
$('.removeBook').on('click', function() {
$('div').remove();
});
$('#createBook').click(function() {
$('#list').append('<div>Hello' + '<button type="button" name="removeBook" class="removeBook">Remove</button>' + '</div>');
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<button type="button" name="createBook" id="createBook">Create</button>
<div id="list">
</div>
おかげで、あなたは私を助けることができる場合:=) は、だからここに私のコードです!
に要素を自分のコードを変更する必要があります。 1つの解決策は、[イベント委任](https://learn.jquery.com/events/event-delegation/)を使用することです。 – Andreas