How do we store a string in localStorage?

后端 未结 4 1286
梦如初夏
梦如初夏 2021-01-13 19:14

I\'m learning javascript, xml, and html. For a homework assignment, I need to retrieve some data from some nodes of a XML file, concatenate the data, and store the concaten

4条回答
  •  Happy的楠姐
    2021-01-13 19:54

    You can use the setItem() to set a value to the localStorage and getItem() to retrieve it

    Ex:

    localStorage.setItem('mykey', 'somevalue')
    

    Demo: Fiddle

提交回复
热议问题