What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-11-14 18:15:16
what is Window local storage
function createItem() { localStorage.setItem('nameOfItem', 'value'); } createItem() // Creates a item named 'nameOfItem' and stores a value of 'value' function getValue() { return localStorage.getItem('nameOfItem'); } // Gets the value of 'nameOfIt... Add solution -
Javascript 2021-11-13 07:29:11
save text of div to localStorage, update localStorage when text is changed
// get the text var text = $('#test').text(); // set the item in localStorage localStorage.setItem('test', text); // bind text to 'blur' event for div $('#test').on('blur', function() { // check the new text var newText = $(this).text(); /... Add solution -
Javascript 2021-11-08 20:46:14
localsstorage array append element
function addEntry() { // Parse any JSON previously stored in allEntries var existingEntries = JSON.parse(localStorage.getItem("allEntries")); if(existingEntries == null) existingEntries = []; var entryTitle = document.getElementB... Add solution -
Javascript 2021-11-06 11:15:10
interceptor in angular 8
// src/app/auth/auth.service.ts import { Injectable } from '@angular/core'; import decode from 'jwt-decode'; @Injectable() export class AuthService { public getToken(): string { return localStorage.getItem('token'); } public isAuthenticate... Add solution -
TypeScript 2021-11-02 22:56:13
how push objects into a local stotage array
// Get the existing data var existing = localStorage.getItem('myFavoriteSandwich'); // If no existing data, create an array // Otherwise, convert the localStorage string to an array existing = existing ? existing.split(',') : []; // Add new data to loca... Add solution