Return to Snippet

Revision: 29743
at August 4, 2010 08:51 by adriamooney


Initial Code
//demo of localStorage
	
	$(function() {

		var someSection = document.getElementById('someSection');

		$(someSection).blur(function() {
			localStorage.setItem('toDoData', this.innerHTML);
		});

		if(localStorage.getItem('toDoData')) {
			someSection.innerHTML = localStorage.getItem('toDoData');
		}
	});
	
<ul id="someSection" contenteditable="true">
    <li>add stuff here</li>
</ul>

Initial URL
http://net.tutsplus.com/tutorials/html-css-techniques/25-html5-features-tips-and-techniques-you-must-know/

Initial Description
this shows you how to use localStorage to have a page remember content that has been edited with the html5 attribute, contenteditble

Initial Title
jquery localStorage for contenteditable content to remember edited content

Initial Tags
jquery, html5

Initial Language
jQuery