如何获取wysihtml5的内部html
How do I get the inner html of a wysihtml5
我有两个wysihtml5字段出现在一个页面上。我希望能够用来自class="vLargeTextField wysihtml5-editor"
的文本实时更新文本区域class="vLargeTextField"
,反之亦然。如果我更新id="user_input"
class="vLargeTextField wysihtml5-editor"
,则id="user_input"
class="vLargeTextField"
应当针对适当的输入进行更新。
我试着做了一些类似的事情:
Userinput1 = $(".wysihtml5-sandbox").contents().find("body").html()
如果屏幕上只有一个编辑器,效果会很好。它返回user_input
,但如果我更新user_input2
,带有类似行的代码将不会。此外,如果我更新user_input
或user_input2
,我希望使用来自user_input 1或2的输入来更新适当的class="vLargeTextField wysihtml5-editor"
。
如有任何帮助,我们将不胜感激。请参阅以下代码:
<div name="newboxes" id="user_input" class="text">
<div style="display:inline-block">
<textarea class="vLargeTextField" cols="80" id="user_input" name="results" rows="20" style="width: 640px; height: 200px; margin: 0px auto; display: none;"></textarea>
<iframe class="wysihtml5-sandbox" security="restricted" allowtransparency="true" frameborder="0" width="0" height="0" marginwidth="0" marginheight="0" style="background-color: rgb(255, 255, 255); border-collapse: separate; border: 0.9090908765792847px solid rgb(204, 204, 204); clear: none; display: inline-block; float: none; margin: 0px auto; outline: rgb(85, 85, 85) none 0px; outline-offset: 0px; padding: 3.9914772510528564px 5.994318008422852px; position: static; top: auto; left: auto; right: auto; bottom: auto; z-index: auto; vertical-align: middle; text-align: start; box-sizing: content-box; -webkit-box-shadow: rgba(0, 0, 0, 0.0745098) 0px 0.9090908765792847px 0.9090908765792847px 0px inset; box-shadow: rgba(0, 0, 0, 0.0745098) 0px 0.9090908765792847px 0.9090908765792847px 0px inset; border-top-right-radius: 3.9914772510528564px; border-bottom-right-radius: 3.9914772510528564px; border-bottom-left-radius: 3.9914772510528564px; border-top-left-radius: 3.9914772510528564px; width: 640px; height: 200px;"></iframe>
#document
<html>
<body marginwidth="0" marginheight="0" contenteditable="true" class="vLargeTextField wysihtml5-editor" spellcheck="true" style="background-color: rgb(255, 255, 255); color: rgb(85, 85, 85); cursor: auto; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13.63636302947998px; font-style: normal; font-variant: normal; font-weight: normal; line-height: 20px; letter-spacing: normal; text-align: start; text-decoration: none; text-indent: 0px; text-rendering: auto; word-break: normal; word-wrap: break-word; word-spacing: 0px;">
"Some Text Here"
</body>
</html>
</div>
</div>
<div name="newboxes" id="user_input2" class="text">
<div style="display:inline-block">
<textarea class="vLargeTextField" cols="80" id="user_input2" name="results" rows="20" style="width: 640px; height: 200px; margin: 0px auto; display: none;"></textarea>
<iframe class="wysihtml5-sandbox" security="restricted" allowtransparency="true" frameborder="0" width="0" height="0" marginwidth="0" marginheight="0" style="background-color: rgb(255, 255, 255); border-collapse: separate; border: 0.9090908765792847px solid rgb(204, 204, 204); clear: none; display: inline-block; float: none; margin: 0px auto; outline: rgb(85, 85, 85) none 0px; outline-offset: 0px; padding: 3.9914772510528564px 5.994318008422852px; position: static; top: auto; left: auto; right: auto; bottom: auto; z-index: auto; vertical-align: middle; text-align: start; box-sizing: content-box; -webkit-box-shadow: rgba(0, 0, 0, 0.0745098) 0px 0.9090908765792847px 0.9090908765792847px 0px inset; box-shadow: rgba(0, 0, 0, 0.0745098) 0px 0.9090908765792847px 0.9090908765792847px 0px inset; border-top-right-radius: 3.9914772510528564px; border-bottom-right-radius: 3.9914772510528564px; border-bottom-left-radius: 3.9914772510528564px; border-top-left-radius: 3.9914772510528564px; width: 640px; height: 200px;"></iframe>
#document
<html>
<body marginwidth="0" marginheight="0" contenteditable="true" class="vLargeTextField wysihtml5-editor" spellcheck="true" style="background-color: rgb(255, 255, 255); color: rgb(85, 85, 85); cursor: auto; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13.63636302947998px; font-style: normal; font-variant: normal; font-weight: normal; line-height: 20px; letter-spacing: normal; text-align: start; text-decoration: none; text-indent: 0px; text-rendering: auto; word-break: normal; word-wrap: break-word; word-spacing: 0px;">
"Some Text Here"
</body>
</html>
</div>
</div>
你的问题回答了我的问题。在您的情况下,我刚刚在jQuery选择器中添加了一个ID
Userinput = $("#user_input .wysihtml5-sandbox").contents().find("body").html()
Userinput1 = $("#user_input1 .wysihtml5-sandbox").contents().find("body").html()
相关文章:
- 内部分区字体大小获胜'调整浏览器窗口大小时不会随媒体查询而更改
- 调用函数内部的函数
- 如何使用js将SNAPSHOT内部版本号转换为3位数的整数
- 在phonegap应用程序内部重定向不起作用
- 使用此选项选择父类内部的类
- 访问JSON对象内部的数组元素
- 从模块内部访问Express装载路径
- AngularJs指令,该指令创建内部有数据对象的新指令
- 如何使用内部对象构造对象
- 根据选项卡内部的文本链接中的哈希ID动态选择jqueryUI选项卡
- 用Javascript修改内部标记的CSS规则
- javascript函数内部的代码用逗号而不是分号分隔
- 正在$rootScope上达到控制器作用域$在内部控制器上
- 光线投射从内部投射时不会碰到网格
- javascript无法重新定义函数内部的全局对象
- 在不移动内部文本的情况下缩放元素的效果
- JavaScript goto 标签如何使用内部循环
- Javascript:循环属性内部的条件递增或递减
- 将当前用户的 ID 推送到 meteorjs 中集合/文档的内部数组
- 如何获取wysihtml5的内部html