Skip to content Skip to sidebar Skip to footer

How To Delete Parts Of Local Storage With Removeitem?

I am creating a web app which tracks people's weight. I have one page where an array is stored in local storage and displayed to the user. The page im currently working on now, inp

Solution 1:

rename the function

remove(); 

to

removeStorage();

remember to update the onClick as well.

remove(); 

is running on the button not calling your function!

A much more sucinct function would be:

functionUpdateWeight(inputID){

    localStorage.userInfo = document.getElementById(inputID).value;

    document.getElementById("result").innerHTML = localStorage.userInfo;

}

From what you have shown this does what you want - replaces original item with new item on button click?

Post a Comment for "How To Delete Parts Of Local Storage With Removeitem?"