Skip to content
Advertisement

How do I make an alert box’s input change the value in localstorage? [closed]

I’m trying to make a bookmarklet that modifies the “local storage” for a game online, but I want it to question the user the amount of “coins” the user wants via an alert.

This is the code

JavaScript

Advertisement

Answer

You can do something like this:

JavaScript

This way you get the last stored value pre filled and you can change it to the new value, which gets stored in localStorage.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement