local storage - Filter content in localStorage -


i'm using localstorage store data user may see , isn't allowed see.

now i'm iterating on whole localstorage data display in list, issue other data comes (such variables, etc...)

for (i = 0; < tracks_recorded; i++) {     $("#history_tracklist").append("<li><a href='#track_info'>" + window.localstorage.key(i) + "</a></li>"); } 

how can filter content of localstorage hide "city" key displaying?

thanks!

var $tracklist = $('#history_tracklist'),     $info = $('<li><a href='#track_info'></a></li>'); (var i=0; i<localstorage.length; i++) {   var key = localstorage.key(i);   if (key !== 'city') {     $tracklist.append($info.clone().text(key));   } } 

oh, , if looking easier ways use localstorage or sessionstorage (including namespaces keep "private" stuff separate, might consider using https://github.com/nbubna/store library. don't need simple case describe, if things more complex, richer api come in handy.


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -