-
-
Save dce/f343541bc67eef9b2502 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script type="text/javascript" src="http://www.google.com/jsapi"></script> | |
<script>google.load("jquery", "1.4.2");</script> | |
<script> | |
$(document).ready(function() { | |
var $list = $("#items li"); | |
var loadItems = function() { | |
$.each(localStorage['items'].split('\n'), function() { | |
$list.append("<li>" + this + "</li>"); | |
}); | |
} | |
if (localStorage['items']) { | |
loadItems(); | |
} else { | |
localStorage['items'] = ""; | |
} | |
$("#new-todo").submit(function() { | |
localStorage['items'] += "\n" + $("#new-todo-text").val(); | |
return false; | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<h1>HTML5 Test</h1> | |
<ul id="items"> | |
<li>WHOA</li> | |
</ul> | |
<form id="new-todo"> | |
<input type=text id="new-todo-text" /> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment