i've made a fucntion that when i click itemEl it should remove the item from fb database.
but whenever i click it i get the location of the element but the remove function doesnt seem to do anything... other than that i have no error code.
我已经做了一个功能,当我点击ItemEL时,它应该从FB数据库中删除该项目。但每当我单击它时,我都会得到元素的位置,但Remove函数似乎没有做任何事情……除此之外,我没有错误代码。
I am a newbie here so i'm probably missing something
我是这里的新手,所以我可能错过了什么
function addToShoppinglist(item) {
let ItemEl = document.createElement("li");
ItemEl.append(item)
shoppingListEl.append(ItemEl)
ItemEl.addEventListener("click", function() {
let exactLocationItem = ref(database, `items/${item}`);
console.log(exactLocationItem);
remove(ref(database, `items/${item}`));
});
it looks like everything is fine except that the remove function does nothing. all the console.log gets me what i (think) intend to get
看起来一切都很好,除了Remove函数什么也不做。所有的console.log都得到了我认为想要得到的东西
更多回答
I figured it out. getexactloactaion did not give me the location of the key whchi i needed but it give me the location of the item
我想通了。它没有给我我所需要的钥匙的位置,但它给了我物品的位置
优秀答案推荐
我是一名优秀的程序员,十分优秀!