0

我使用SCEditor插件作为富编辑器。这个插件在我的 html 页面中生成一个 iframe。当我键入所有内容时,此编辑器会在该 iframe 中添加一些 html 元素。现在,我需要捕获更改 iframe 内容的事件。我怎样才能做到这一点?

这是插件生成的 html 代码:

<div id="editor" ... >
     ...
    <iframe>
       <!DOCTYPE html>
       <html>
          <head>...</head>
          <body>
              //This content changes when i type every thing
          </body>
      </html>
    </iframe>
</div>
4

1 回答 1

1

利用

$(pointerToContainerEditor).sceditor('instance')

.sceditor()(考虑 $(pointerToContainerEditor) 一个变量,其中包含与用于初始化 SCE的方法相同的变量。)
获取您正在使用的编辑器实例。然后使用方法

http://www.sceditor.com/api/sceditor/bind/
+
http://www.sceditor.com/api/sceditor/val/

用于.bind()向编辑器添加事件侦听器。最常见的 DOM 事件可用。使用.val()在当前模式下获取当前值。阅读上面的链接以获取更多信息,如果您仍然没有得到它,请随时询问。

于 2015-05-14T08:02:53.287 回答