有谁知道为什么我不能删除列表中的字母B?
重现的步骤:
HTML:
return Gists.query().$promise.then(function(response){
// Gists has finished and the data it returned is in response
// Now run your second query, using the response from the first
return Meta.get({ id : response.id }).$promise.then(function(nextResponse){
// Now nextResponse will contain the result of Meta.get(), having used the id that returned from the first response
console.log(nextResponse);
});
});
的Jquery:
<button id="add">Add to list</button>
<ol>
<li>A</li>
<li>A</li>
<li>A</li>
</ol>
您可以在jsfiddle中找到示例。
最好的问候。
答案 0 :(得分:2)
这种情况正在发生,因为附加新元素时会丢失事件处理程序。您可以参考以下答案中的解决方案,了解如何正确执行此操作。 jQuery how to bind onclick event to dynamically added HTML element
Here is your JSFiddle
https://jsfiddle.net/qsh4pb5r/1/
答案 1 :(得分:0)