jQuery.localStorage() - jQuery SDK API

jQuery.localStorage() - jQuery SDK API

jQuery.localStorage()

From jQuery SDK API

 
Jump to: navigation, search
Categories: Data

Contents:

jQuery.localStorage( key )Returns: Object

Description: Get a value from the local storage.

Plugin: jQuery.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.

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

jQuery.localStorage( key, value )

Description: Set a value to the local storage.

Plugin: jQuery.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.

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

你可能感兴趣的:(localStorage)