Search.../

setItem( )

Stores an item in local, session, or memory storage.

Note: You can store up to 50kb of data in local and session storage and up to 1mb in memory storage.

Syntax

function setItem(key: string, value: string): void

setItem Parameters

NAME
TYPE
DESCRIPTION
key

string

The key of item to set.

value

string

The value of the item to set.

Returns

This function does not return anything.

Return Type:

void

Related Content:

Was this helpful?

Store an item in local storage

Code Example

Copy Code
1import {local} from 'wix-storage';
2
3// ...
4
5local.setItem("key", "value");
Store an item in session storage

Code Example

Copy Code
1import {session} from 'wix-storage';
2
3// ...
4
5session.setItem("key", "value");
Store an item in memory storage

Code Example

Copy Code
1import {memory} from 'wix-storage';
2
3// ...
4
5memory.setItem("key", "value");