Skip to main content
1 de 3
user avatar
user avatar

Use o autoSave – A jQuery Plugin exemplo funcional

<textarea class="form-control" rows="6" id="idTextArea" placeholder="digite aqui ..."></textarea>

<script>  
/*
 jQuery autoSave v1.0.0 - 2013-04-05
 (c) 2013 Yang Zhao - geniuscarrier.com
 license: http://www.opensource.org/licenses/mit-license.php
 */
(function(a){a.fn.autoSave=function(d,e){return this.each(function(){var b=0,c=a(this),f=e||1E3;c.keyup(function(){clearTimeout(b);var a=c.val();localStorage&&localStorage.setItem("autoSave",a);b=setTimeout(function(){d()},f)})})}})(jQuery);

var demoText = $("#idTextArea");


if (localStorage) {  
  var content = localStorage.getItem("autoSave");
  if (content) {
      demoText.text(content);
  }
}

</script>
user60252