从contenteditable div中通过javascript获取文本内容 [英] get the text content from a contenteditable div through javascript

查看:374
本文介绍了从contenteditable div中通过javascript获取文本内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过javascript从contentEditable div检索文本内容。这样做有什么选择?我尝试了innerHTML,但它不起作用。

解决方案

使用jQuery并执行

var content = $('#my-contenteditable-div')。html();

也查找这些链接: $ b

http://west-wind.com/Weblog/posts/778165.aspx



从contentEditable div中提取文本


I want retrieve the text content from a contentEditable div through javascript. What are the options of doing this? I've tried innerHTML but it doesn't work.

解决方案

use jQuery and do

var content = $('#my-contenteditable-div').html();

also look up these links:

http://west-wind.com/Weblog/posts/778165.aspx

Extracting text from a contentEditable div

这篇关于从contenteditable div中通过javascript获取文本内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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