javascript - Unable to retrieve local storage variable -


hello having issue following code, trying store variable local storage , retrieve variable local storage...

storing contents of .product-name h1:

localstorage.productname = jquery('.product-name h1').html(); 

now trying console.log variable local storage:

console.log(localstorage.getitem('productname')); 

however when console.log sends 'null', idea why might happening?

thanks, nick

try using setitem method in order store value local storage:

localstorage.setitem('productname', jquery('.product-name h1').html()); 

Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -