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
Post a Comment