leonteale

html5 and Jquery todo list

Oct 10th, 2012
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.77 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
  5. <script type="text/javascript">
  6. $(function() {
  7.         var edit = document.getElementById('edit');
  8.  
  9. $(edit).blur(function() {
  10.         localStorage.setItem('tododata', this.innerHTML);
  11. });
  12.  
  13.         //when loads
  14.         if ( localStorage.getItem('tododata') ) {
  15.         edit.innerHTML = localStorage.getItem('tododata');
  16. }
  17.  
  18.  
  19. });</script>
  20.  
  21.  
  22.     <meta charset="utf-8">
  23.     <title>untitled</title>
  24. </head>
  25. <body>
  26.     <h2> To-Do List </h2>
  27.      <ul id="edit" contenteditable="true">
  28.         <li> Break mechanical cab driver. </li>
  29.         <li> Drive to abandoned factory
  30.         <li> Watch video of self </li>
  31.      </ul>
  32. </body>
  33. </html>
Advertisement
Add Comment
Please, Sign In to add comment