我不明白为什么 jQuery 函数不能与这里的 html 一起使用 JS fiddle :http://jsfiddle.net/JonaTheApprentice/E89rg/
function addItem() {
$('#list').append('<li><input type="checkbox" /> item</li>');
}
function removeItem() {
$('#list').children().filter(function () {
return this.firstChild.checked;
}).remove();
}
最佳答案
我没有看到带有 id="list"
的元素,这就是 #list
所指的元素。
我认为你的意思是#items-listed
。改变它,它就起作用了
关于javascript - 是什么导致我的 jQuery 函数无法运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21614171/