Javascript-questions about the local storage data initialization page !!!

Source: Internet
Author: User
I have stored some data in localStorage. Then, when initializing the page, I need to fill in the number of the data to the plus or minus sign of the page. how can I solve this problem in general? I want to use the jquery selector to select the corresponding data-id attribute and then fill it in. this...

I stored some data in localStorage.

Then, when initializing the page, I need to fill in the number of the data to the plus or minus sign of the page. how can I solve this problem? What I want is to use the jquery selector to select the corresponding data-id attribute and then fill it in. is this desirable? Is there a better way?

...]

Reply content:

I stored some data in localStorage.

Then, when initializing the page, I need to fill in the number of the data to the plus or minus sign of the page. how can I solve this problem? What I want is to use the jquery selector to select the corresponding data-id attribute and then fill it in. is this desirable? Is there a better way?

...]

I think this method is!

You can do this by using this method to process objects in localStorage.

{    20160611:{name:"test"...},    20160612:{name:"test"...},    20160613:{name:"test"...}}

Put the entire object in a key.

Thank you for your invitation. You can.

Thank you!
This method is feasible.

Thank you for inviting me. I have never actually tried it. in principle, it should be okay. just try it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.