Cannot store a value in local storage

后端 未结 2 1413

I have fetched a list of items from web service, now i want to store the item_name on which I have clicked. I cannot store that item name, if its \"bread butter\" , it stores on

2条回答
  •  既然无缘
    2021-01-28 08:45

    DOM Storage Guide

    Example

    var string = 'Bread Butter';
    
    localStorage.setItem("DishName", string);
    
    alert(localStorage.getItem('DishName'));
    

    On jsFiddle

提交回复
热议问题