Skip to content
ekdevdes edited this page Jan 29, 2013 · 4 revisions

Need an example of using Storage.js to save the new text of the element to your Database? Look no further.

First include the latest version of jQuery

<script src="http://code.jquery.com/jquery.min.js"></script>

Next, include Storage.js and Cookies.js (a dependency of Storage.js used for IE Support) in your project

Please Note: You can find the unminified version at: http://cdn.jsdelivr.net/storagejs/2.0/storage.js

<script src="http://cdn.jsdelivr.net/cookiejs/0.1/cookie.min.js"></script>
<script src="http://cdn.jsdelivr.net/storagejs/2.0/storage.min.js"></script>

Last but not least, call Storage.js on whatever elements you wish to editable.

$('#theElement').storage({storageKey:'storageKey'});
  • $('#element') is the element you want the HTML5 contentEditable attribute to placed on
  • The 'storageKey' is what will the element's key will be in localStorage
  • For a complete list of options you can pass please refer to the API & Options Section of the Website

That's it! Have Fun!

Clone this wiki locally