title: localStorage - looping through a value of a specific key in javascript
body: <p>This might be tricky to explain, so I'll do my best.</p>
  
  <p>I'm trying to use localstorage in a way, that im not even sure if its possible.
  Basically I want to submit some values as a list. 
  When the user reloads, it pulls those values from the local storage and displays them.</p>
  
  <p>Ideally, i wanted to store each value under the same Key and try and loop through that key and print the values associated with that key.
  As you can see when I reload, it's loading  each letter in the array since its looking at the length of the entire value and not each word.</p>
  
  <p>I know Im a bit off, but its about as far as I got. Would appreciate any hints (I've never worked with localStorage, so its a bit new to me)</p>
  
  <p>consider this:</p>
  
  <pre><code>    var i = 0;
      var taskArray = [];
      var storedTasks = localStorage.getItem('Tasks');
  
    for( i = 0; i &lt; localStorage.length; i++)
      $("#tasks").append("&lt;li id='task-"+ i +"'&gt;" + storedTasks[i] + "&lt;/li&gt;");
  
  
       // Add a task
      $("#tasks-form").submit(function() {
          if ($("#task").val() != "") {
               $("#tasks").append("&lt;li id='task-" + i + "'&gt;"  + '&lt;span class="taskSpan"&gt;' + $("#task").val() + '&lt;/span&gt;' + '&lt;/li&gt;')
              $("#task-" + i).css('display', 'none');
              $("#task-" + i).fadeIn(350);
              taskArray.push($("#task").val());
              localStorage.setItem('Tasks', taskArray);
              i++;
  
          }
  
          return false;
      });
  </code></pre>
  
  <p><a href="http://jsfiddle.net/GregWebBandit/V6QRR/9/" rel="nofollow">JSFiddle</a></p>