Shortly URL shortener using TailwindCSS and jQuery

Solution retrospective
Hi everyone! Could I please get some help with my local storage? I know I need to work on the responsive version of my output URL but I'm confused me as is to why my local storage does not work correctly.
Please log in to post a comment
Log in with GitHubCommunity feedback
- @tkressma
Hey Jesse, good job.
I HIGHLY recommend you put your script in a seperate file (E.G. script.js) then import it at the end of your body - or, at the very beginning of the body tag using defer.
Similar to what Haybuka said, you first need to "fill" your localStorage with an item before trying to access it. You would want to do this upon successfully fetching some data from the API. You can do this by writing localStorage.setItem('<some name resembling the url data>', <the object recieved from the api call>). Then, when you want to retrieve the localStorage data, you would write localStorage.getItem('<name you decided on calling the item'>).
Check out more about localStorage on the docs: https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
- @Haybuka
Hi... Nice Usage of JQuery, Maybe try use a separate JS file instead of the embedded with HTML... For the local storage, i couldnt find where you set your data to localStorage,you have to set it up,before you can pull from it.... Nice work on the documentation also
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord