This code save `1 number` in `localstorage` and the time the number was generated, after 1 minute the item is changed in `localstorage` and shown in htm.

**I'm looking for a way to generate 1 number for each item with an ID**

Example:

```
<div id="now">1 now</div>
<div id="now">5 now</div>
<div id="now">8 now</div>

```

at this moment it shows it like this

```
<div id="now">1 now</div>
<div id="now">1 now</div>
<div id="now">1 now</div>

```

My Code

```
 <div id="now"></div>

```

---

```
function hasOneDayPassed() {
  var lastclear = localStorage.getItem('lastclear'),
    now_p = localStorage.getItem('now_p'),
    time_now = (new Date()).getTime();

  if ((time_now - lastclear) > 1000 * 60) {
    localStorage.clear();
    localStorage.setItem('lastclear', time_now);
    localStorage.setItem('now_p', Math.floor(Math.random() * 20) + 4);
  }
  $('#now').text(now_p + ' now');
}
hasOneDayPassed();

```