【发布时间】:2017-09-28 06:00:39
【问题描述】:
基本上,HTML 元素包含一个 body 标记。在这个 body 标签中,我们添加了所需的 html 内容。在我的情况下,HTML 文件有两个正文内容,一个用于整个 html 内容,另一个用于富文本编辑器。我需要使用第二个正文来获取富文本编辑器文本。
我已经尝试如下 get body tag value from website Get all elements in the body tag using pure javascript
第二个body html内容如下,
<body marginwidth="0" marginheight="0" spellcheck="true" class="wysihtml5-editor" style="font-variant-ligatures: normal; font-variant-caps: normal; background-color: rgb(255, 255, 255); color: rgb(95, 100, 104); cursor: auto; font-family: "Open Sans", sans-serif; font-size: 14px; font-style: normal; font-weight: normal; line-height: 18px; letter-spacing: normal; text-align: start; text-decoration: none solid rgb(95, 100, 104); text-indent: 0px; text-rendering: auto; word-break: normal; word-wrap: break-word; word-spacing: 0px;" contenteditable="true">testing</body>
我也尝试使用如下类名,但显示 $(...).text 不是函数。
$(".wysihtml5-editor").text()
请提出您的建议.. 谢谢
【问题讨论】:
-
你确定你已经加载了 jQuery 吗?
-
.text()函数有效。我想知道的是body标签是否会被删除......
标签: javascript jquery html rich-text-editor wysihtml5