Skip to content

Instantly share code, notes, and snippets.

@bryanwb
Created June 23, 2010 02:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryanwb/449391 to your computer and use it in GitHub Desktop.
Save bryanwb/449391 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>storage test w/ jstorage</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="http://github.com/andris9/jStorage/raw/master/jstorage.js"></script>
</head>
<body style="font: 75% Lucida Grande, Trebuchet MS">
<div id="content"></div>
<p id="log" style="color: gray"></p>
<div>
<form>
<table>
<tr>
<td>key</td>
<td><input id="inputKey" type="text"></td>
<td>value</td>
<td><input id="inputVal" type="text"></td>
<td><a id="add" href="#">ADD</a></td>
</tr>
<tr>
<td>key</td>
<td><input id="getKey" type="text"></td>
<td>value</td>
<td id="val"></td>
<td><a id="get" href="#">GET</a></td>
</tr>
</table>
</form>
</div>
<script>
$("#add").bind('click', function(){
var key = $("#inputKey").attr('value');
var value = $("#inputVal").attr('value');
$.jStorage.set(key, value);
});
$("#get").bind('click', function(){
var key = $("#getKey").attr('value');
$("#val").html($.jStorage.get(key));
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment