Retrieving list items


show more Retrieving list items provides you with in-depth training on Web. Taught by Joseph Lowery as part of the HTML5 Projects: Engaging Ecommerce show less
please wait ...

Retrieving list items

It's time for the final step of our project. In the previous lesson, I showed you how ridiculously easy it was to save items in local storage. In this lesson, we'll cover how to retrieve and display them. Ao I have my dragdrop.js file where we put in the saveFaves routine last, and now let's bring in the loadFaves routine. So I'm going to put it at the tail end of the JavaScript code block here, not in any function, so it will run automatically when the page loads.

So there is a call to loadFaves, and now let's put in that code itself. I'll make a little extra room there, so we can see what's happening. So it's function loadFaves curly brace pair. Now the first thing we want to make sure is that the function that we're trying to load exists. So we'll use an if statement, if (localStorage.get item) and then another curly brace and then another set of parentheses and quotes, and we want to check to see if the items favorites is the one that exists.

So ...

Retrieving list items
Video duration: 2m 36s 37m 29s Intermediate

Viewers:

Retrieving list items provides you with in-depth training on Web. Taught by Joseph Lowery as part of the HTML5 Projects: Engaging Ecommerce

Subject:
Web
Software:
HTML JavaScript CSS
Author:
please wait ...