Pro*_*Net 2 javascript c# asp.net jquery tinymce
我有一个包含多个TinyMCE实例的表单.我使用Repeater控件动态创建了TextArea控件 - 它们都具有相同的ID,但我为每个控件赋予了不同的类.我使用TinyMCE Init函数中的editor_selector:选项为每个TextArea控件分配了一个TinyMCE实例.
tinyMCE.init({ mode : 'textareas',theme : 'simple',editor_selector : 'upperBlock',directionality : 'rtl'}); tinyMCE.init({ mode : 'textareas',theme : 'simple',editor_selector : 'middleBlock',directionality : 'rtl'});
Run Code Online (Sandbox Code Playgroud)
我想在JS函数中引用一个特定的TinyMCE实例并获取其内容.在每个TextArea控件具有不同的id的情况下,可以通过使用:
tinyMCE.get('IdOfYourTextBoxWithTheTinyMCEContent').getContent()
Run Code Online (Sandbox Code Playgroud)
有没有办法通过 TinyMCE Init函数的editor_selector选项中分配给它的类来获取特定的TinyMCE实例内容?
谢谢
使用本机TinyMCE方法无法做到这一点.你必须为自己循环,例如(未经测试)
for (edId in tinymce.editors) {
if (tinymce.editors[edId].settings.editor_selector == 'upperBlock') {
// editor found - do something
}
}
Run Code Online (Sandbox Code Playgroud)