使用jquery保存contenteditable数据 [英] Saving contenteditable data using jquery

查看:436
本文介绍了使用jquery保存contenteditable数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用jQuery在本地保存 contenteditable div 的数据。

以下是我所做的:

I'm trying to save a contenteditable div's data locally with jQuery.
Here is whatever I've done: link

请帮我解决这个问题!

推荐答案

将textarea元素更改为div,然后添加contenteditable =true。然后将text.value更改为text.innerHTML。你是这个意思吗?在这个链接中,它似乎适用于我。

Change the "textarea" element to "div" and add contenteditable="true". Then change text.value to text.innerHTML. Is that what you mean? It seems to work for me at this link.

<div id="editor" contentEditable="true" placeholder="Start writing..."></div>
...
[text.innerHTML || text.placeholder], {
...
session.text = text.innerHTML;

这篇关于使用jquery保存contenteditable数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆