Home >Backend Development >PHP Tutorial >javascript - Problems with local storage data initialization page! ! !

javascript - Problems with local storage data initialization page! ! !

WBOY
WBOYOriginal
2016-07-06 13:53:32944browse

I stored some picture data in localStorage
javascript - Problems with local storage data initialization page! ! !

Then, when the page is initialized, I need to fill the quantity in the data between the plus and minus signs on the page. How to solve this problem? What I want is to use jquery selector to select the corresponding data-id attribute and then fill it in. Is this advisable? Is there a better way?
javascript - Problems with local storage data initialization page! ! !
中...]

Reply content:

I stored some picture data in localStorage
javascript - Problems with local storage data initialization page! ! !

Then, when the page is initialized, I need to fill the quantity in the data between the plus and minus signs on the page. How to solve this problem? What I want is to use jquery selector to select the corresponding data-id attribute and then fill it in. Is this advisable? Is there a better way?
javascript - Problems with local storage data initialization page! ! !
中...]

I think this method works!

What can be done is that it would be better if the objects in localStorage can be processed in this way

<code>{
    20160611:{name:"test"...},
    20160612:{name:"test"...},
    20160613:{name:"test"...}
}
</code>

The entire object is placed in a key

First of all, thank you for the invitation. You can do this

Thanks for the invitation
Your method is feasible

Thank you for the invitation. I have never done it in practice. In principle, it should be possible. You will know after you try it

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn