I'd like some help to enter localStorage in javascript . Objective: To make a function of saving information in the input identical to wordpress, example:
InthethirdprintitiswhatIwant,ifitdoesnotenteranythinginthepasswordfield,butalreadytypedinthelogin,itissavedwithoutneedingtoretype.
codethatI'musing:
<scripttype="text/javascript">
function digGet(){
// Cria um item "usuario" com valor "Thiago Belem"
var login = document.getElementById("user_login");
window.localStorage.setItem('usuario', login);
saveGet();
}
function saveGet(){
// Depois, em outra página ou aba, recupera esse item
var usuario = window.localStorage.getItem('usuario');
document.getElementById('user_login').value = usuario;
}
function delGet(){
// Remove o item
window.localStorage.removeItem('usuario');
}
</script>
I want to transform into php this, so that the getItem ('user'); either the user typed in the input by the user.
If someone can help me, I'll be very grateful.