'How can I save placeholder value in local storage [closed]

Hi how can i save the value of placeholder in localstorage? I have no idea how I could do this (I'd like to do it in js / jquery)

My curent code:

let webhook; {
    if(localStorage.getItem('webhook') == null)localStorage.setItem('webhook','none')
};

<input id="webhook" value="`+localStorage.getItem('webhook')+`">

This only displays the value from the placeholder, but does not change.



Solution 1:[1]

localStorage.setItem(test, 'test');

document.getElementById("test").placeholder = localStorage.getItem(test)
<input id="test"/>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 qvasz