How to append to HTML5 localStorage?

前端 未结 3 1233
情书的邮戳
情书的邮戳 2020-12-15 14:08

I do a

localStorage.setItem(\'oldData\', $i(\"textbox\").value);

to set the value of key oldData to the value in a textbox.

3条回答
  •  被撕碎了的回忆
    2020-12-15 14:40

    It is not a good solution but it works and is performative.

    localStorage.setItem("fruit", "Apples"); 
    
    localStorage.setItem("fruit", localStorage.getItem("fruit") + "Orange");
    

提交回复
热议问题