N
N
Natalia2019-02-21 18:50:58
JavaScript
Natalia, 2019-02-21 18:50:58

How to keep added list in localSrorage after page refresh?

Good afternoon!
Help, please, deal with the issue.
I do this: https://jsfiddle.net/nlynx/74eo9a2g/3/

Here you can drag tasks into different blocks and add new tasks.
It is necessary that at least when the page is refreshed, the current working state remains unchanged, and not reset to default.

Thank you in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2019-02-21
@lota

localStorage.setItem('items', JSON.stringify(this.items)); // записать
this.items = JSON.parse(localStorage.getItem('items')) || []; // получить

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question