Listing down stored records localStorage | Google Chrome Extensions

Posted by Jamie on Stack Overflow See other posts from Stack Overflow or by Jamie
Published on 2010-05-09T22:08:44Z Indexed on 2010/05/09 22:18 UTC
Read the original article Hit count: 377

How do I get to list down the stored records in the for loop?

Basically I want it to list down the records like this:

'<div id="record_' + number + '">' + localstorage value + '</div>'

The number in the class should add 1 every record, e.g. 1, 2, 3, 4 every record it lists down, and so on.

The localstorage value should show the localStorage[] but the problem is, the localStorage name has the same, e.g.

(clicks on button)

it will save the value of the URL into a localStorage

I then open the application and shows the window.html

inside there is list of stored records by using this:

'<div id="record_' + number + '">' + localstorage value + '</div>'

INCLUDING the record number to add per record 1, 2, 3, etc... like this:

<div id="record_1">localstorage value</div>
<div id="record_2">localstorage value</div>
<div id="record_3">localstorage value</div>
<div id="record_4">localstorage value</div>
<div id="record_5">localstorage value</div>
<div id="record_6">localstorage value</div>

etc...

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about for-loop