1
I would like a help to enter the localStorage in javascript. Objective: Make a function to save information in the input identical to wordpress, example:
In the third print is what I want, if he does not enter anything in the password field, but already typed in the login, is saved, no need to write.
code I’m using:
<script type="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 turn this into php, so getItem('user'); be the user typed in input by the user.
If anyone can help me, I’d be grateful.
do you want to save a user without password? and in case several people with the same name register ?
– Victor
no, I want the guy after typing a user, stay saved in the field even though he giving F5
– Jeferson Santos
Usually browsers do this without having to use cookies or localStorage. You really think this is a relevant feature?
– Guilherme Nascimento
Yes, I think, because then my login system will be Perfect.
– Jeferson Santos