html local storage

http://jsbin.com/iqura/edit#javascript,html

jQuery(function($){
	var edit = $('.edit');
	edit.blur(function() {
		localStorage.setItem('todoData', this.innerHTML);
	});
	if ( localStorage.getItem('todaData') ) {
		edit.innerHTML = localStorage.getItem('todoData');
	}
});
<!doctype html>
<html>
<head>
	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
	<script src="script.js"></script>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>title</title>
</head>
<body>
<section>
	<ul class="edit" contenteditable="true">
		<li>Sample data</li>
	</ul>
</section>
</body>
</html>
VN:F [1.9.17_1161]
Rating: 0 (from 0 votes)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">