Created
August 28, 2011 23:59
-
-
Save zackify/1177422 to your computer and use it in GitHub Desktop.
Auto loading and saving for content
This file contains hidden or 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
<script type="text/javascript"> | |
$(document).ready(function(){ | |
var edit = document.getElementById('edit'); | |
$(edit).blur(function() { | |
localStorage.setItem('todoData', this.innerHTML); | |
}); | |
// when the page loads | |
if ( localStorage.getItem('todoData') ) { | |
edit.innerHTML = localStorage.getItem('todoData'); | |
} | |
// to reset | |
// localStorage.clear(); | |
setInterval('save()',200); | |
}); | |
function save(){ | |
var edit = document.getElementById('edit'); | |
localStorage.setItem('todoData', edit.innerHTML); | |
// to reset | |
// localStorage.clear(); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment