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 :: select 2 placeholder 
Javascript :: remove commas from string javascript 
Javascript :: Consider using the "jsdom" test environment. 
Javascript :: textinput disable react native 
Javascript :: javascript hide element by class 
Javascript :: This is probably not a problem with npm. There is likely additional logging output above. 
Javascript :: event exit fullscreen 
Javascript :: add site url validation regex 
Javascript :: jquery css add important 
Javascript :: colored console.log 
Javascript :: number to char js 
Javascript :: moment format datetime postgresql 
Javascript :: split into sentences at any punctuation javascript 
Javascript :: how to check if local storage variable exists in javascript 
Javascript :: disable right click jquery 
Javascript :: javascript urlencode json 
Javascript :: remove yellow warning react native emulator 
Javascript :: how to displayan inteiger to a tenth in javascript 
Javascript :: how to disable ctrl key using javascript 
Javascript :: how to hide header in react navigation 
Javascript :: javascript leave page warning 
Javascript :: drupal 8 link render array 
Javascript :: yup email validation 
Javascript :: javascript function to format phone number 
Javascript :: js copy 2d array 
Javascript :: javascript get scroll position 
Javascript :: urlencode jquery 
Javascript :: jquery check scroll direction 
Javascript :: regex match letters and special characters 
Javascript :: convert number to comma separated format javascript 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =