How to use sessionStorage?

0

I'm trying to pass the value of a one-page input to fill another input on another page using session5's HTML5 session, I would like to know why this code is not working.

//função que captura o valor de um input na página 1
    function valor(){
        var email = document.getElementById('email');
        var emailValor = email.value;

        var teste = window.localStorage.setItem('valor', emailValor);
        console.log(emailValor);        
    }
    valor();

//função que mostra o valor em outro input na página 2
    function mostraValor(){
        var data = window.localeStorage.getItem('valor');
            document.getElementById('email').value = data;
            console.log(data);
    }   
    mostraValor();
    
asked by anonymous 30.11.2017 / 12:24

3 answers

1

Hello, you have a typing error. try changing

var data = window.localeStorage.getItem('valor');

by

var data = window.localStorage.getItem('valor');
    
30.11.2017 / 13:03
-1

Try changing the code (both in setItem and getItem):

window.localStorage

by

sessionStorage
    
30.11.2017 / 12:31
-3

Calculator with sessionStorage

link

    
06.11.2018 / 15:00