我有“dinamic”手风琴。单击“addBtn”创建新元素。每个元素都有删除当前元素的“删除”按钮。
HTML
<div id="accordion">
<div id="aE">
<div id="aT" class="aT_val">
<h3></h3>
</div>
<div id="aC" class="aC_val">
<p></p>
</div>
<div id="deleteBtn" class="deleteBtn"><img src="images/del.png"></div>
</div>
</div>
JS
$('#addBtn').click(function() {
count++;
$('#accordion').append('<div id="aE' + count + '"><div id="aT' + count + '" class="aT_val"><h3></h3></div><div id="aC' + count + '" class="aC_val"><p></p></div><div id="deleteBtn' + count + '" class="deleteBtn"><img src="images/delete-button.png"></div></div>'); });
$('#deleteBtn' + count).click(function() {
$('#aE' + count).remove();
});
但是“deleteBtn”不会删除元素“aE”。如何解决?