Search...
removeItem( )
Removes an item from local, session, or memory storage.
Syntax
function removeItem(key: string): void
removeItem Parameters
NAME
TYPE
DESCRIPTION
key
string
The key of the item to remove.
Returns
This function does not return anything.
Return Type:
void
Related Content:
Was this helpful?
Remove an item from local storage
Copy Code
1import {local} from 'wix-storage-frontend';23// ...45local.removeItem("key");
Remove an item from session storage
Copy Code
1import {session} from 'wix-storage-frontend';23// ...45session.removeItem("key");
Remove an item from memory storage
Copy Code
1import {memory} from 'wix-storage-frontend';23// ...45memory.removeItem("key");
Manage data stored in the browser
This example shows how to manage data stored in the browser. Adjust the import statement to use different storage types. You can test out the code in our example template.
Copy Code
1import {local as storage} from 'wix-storage-frontend';2// Alternatively use:3// import {session as storage} from 'wix-storage-frontend';4// import {memory as storage} from 'wix-storage-frontend';56$w.onReady(async function () {7 $w('#setItemButton').onClick( () => {8 storage.setItem($w('#setKey').value, $w('#setValue').value);9 $w('#setKey').value = undefined;10 $w('#setValue').value = undefined;11 });1213 $w('#getItemButton').onClick( () => {14 $w('#getValue').value = storage.getItem($w('#getKey').value);15 $w('#getKey').value = undefined;16 });1718 $w('#removeItemButton').onClick( () => {19 storage.removeItem($w('#removeKey').value);20 $w('#removeKey').value = undefined;21 });2223 $w('#clearButton').onClick( () => {24 storage.clear();25 });26});27