Categories

jQuery.localStorage()

Categories: Data

jQuery.localStorage( key )Returns: Object

Plugin: jQuery.storage

Description: Get a value from the local storage.

  • jQuery.localStorage( key )

    version added: 1.0

    key   A key of a stored value.

The jQuery.localStorage() method uses the native localStorage, if the localStorage object not available, the storage will be handled with cookies as fall back method.

  • Get a value from the local storage.

    Code:
    $.localStorage( 'foo', {data:'bar'} );
    
    $.localStorage( 'foo' );
    Results:
    {data:'bar'}

jQuery.localStorage( key, value )

Plugin: jQuery.storage

Description: Set a value to the local storage.

  • jQuery.localStorage( key, value )

    version added: 1.0

    key   A key for value to store.

    value   A value to store.

The jQuery.localStorage() method uses the native localStorage, if the localStorage object not available, the storage will be handled with cookies as fall back method.

  • Set a value to the local storage.

    Code:
    $.localStorage( 'foo', {data:'bar'} );