Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript localStorage clear items

localStorage.clear();//this clears the localStorage completely
Comment

js clear local storage

localStorage.clear();//WARNING!: This will clear all your local storage
Comment

how to clear local storage

localStorage.clear();
Comment

js localstorage clear

<!DOCTYPE html>
<html>
  <head>
    <style>
      body {
        text-align: center;
      }
      h1 {
        color: green;
      }
    </style>
  </head>
  <body>
    <h2>Create local storage items </h2>
    <button onclick="createItems()">
      Create local storage items
    </button>
    <h2>Display Items</h2>
    <button onclick="displayItems()"> Display items</button>
    <p id="show"></p>
    <h2>Remove Items</h2>
    <button onclick="deleteItems()"> Clear locak storage </button>
    <h2>Display Items Again</h2>
    <button onclick="displayItems()"> Display again </button>
    <p id="demo"></p>
    <script>
      function createItems() {
        // Set item in local storage. 
        localStorage.setItem("Welcome toW3Docs ", " ");
        localStorage.setItem("Storage Clear Method ", " ");
      }
      function deleteItems() {
        // Clear localStorage items 
        localStorage.clear();
      }
      function displayItems() {
        let l, i;
        // Display items 
        document.getElementById("show").innerHTML = "";
        for(i = 0; i < localStorage.length; i++) {
          res = localStorage.key(i);
          document.getElementById("show").innerHTML += res;
        }
      }
    </script>
  </body>
</html>
Comment

js localstorage clear

<!DOCTYPE html>
<html>
  <head>
    <style>
      body {
        text-align: center;
      }
      h1 {
        color: green;
      }
    </style>
  </head>
  <body>
    <h2>Create local storage items </h2>
    <button onclick="createItems()">
      Create local storage items
    </button>
    <h2>Display Items</h2>
    <button onclick="displayItems()"> Display items</button>
    <p id="show"></p>
    <h2>Remove Items</h2>
    <button onclick="deleteItems()"> Clear locak storage </button>
    <h2>Display Items Again</h2>
    <button onclick="displayItems()"> Display again </button>
    <p id="demo"></p>
    <script>
      function createItems() {
        // Set item in local storage. 
        localStorage.setItem("Welcome toW3Docs ", " ");
        localStorage.setItem("Storage Clear Method ", " ");
      }
      function deleteItems() {
        // Clear localStorage items 
        localStorage.clear();
      }
      function displayItems() {
        let l, i;
        // Display items 
        document.getElementById("show").innerHTML = "";
        for(i = 0; i < localStorage.length; i++) {
          res = localStorage.key(i);
          document.getElementById("show").innerHTML += res;
        }
      }
    </script>
  </body>
</html>
Comment

PREVIOUS NEXT
Code Example
Javascript :: react native paper textinput 
Javascript :: angular two datepickers 
Javascript :: js array map skip element 
Javascript :: return response from async call 
Javascript :: npm: Create react chrome extension 
Javascript :: how to use cros 
Javascript :: send data using axios 
Javascript :: routes in angular 
Javascript :: clear dict javascript 
Javascript :: convert text to qr code in angular 
Javascript :: js round to x decimal places 
Javascript :: js arrow anonymous function 
Javascript :: obtener primer elemento de un array javascript 
Javascript :: how to split an array javascript 
Javascript :: electron 
Javascript :: react-bootstrap-table2-editor 
Javascript :: computed property names 
Javascript :: how javascript run in browser 
Javascript :: Least common multiple from array 
Javascript :: switch19 dynamically update js 
Javascript :: multiple elements with same id jquery 
Javascript :: concat keys json 
Javascript :: react-anime 
Javascript :: array within array javascript 
Javascript :: javascript closest parent 
Javascript :: javascript Rename in the import file 
Javascript :: lodash groupby return array 
Javascript :: Authentication handling in javascript 
Javascript :: Stringy.JS 
Javascript :: remove duplicate values from string in javascript 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =