jquery localStorage for contenteditable content以记住编辑的内容
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jquery localStorage for contenteditable content以记住编辑的内容相关的知识,希望对你有一定的参考价值。
this shows you how to use localStorage to have a page remember content that has been edited with the html5 attribute, contenteditble
//demo of localStorage $(function() { var someSection = document.getElementById('someSection'); $(someSection).blur(function() { localStorage.setItem('toDoData', this.innerHTML); }); if(localStorage.getItem('toDoData')) { someSection.innerHTML = localStorage.getItem('toDoData'); } }); <ul id="someSection" contenteditable="true"> <li>add stuff here</li> </ul>
以上是关于jquery localStorage for contenteditable content以记住编辑的内容的主要内容,如果未能解决你的问题,请参考以下文章
为啥读取 localStorage 值需要刷新页面才能显示由 jQuery 切换的 CSS 更改?
如何使用 jQuery 为所有浏览器绑定到 localStorage 更改事件?