Javascript tinyMCE插件访问元素
我正在尝试编写一个tinymce插件,所以我查阅了在上创建插件的教程。插入和替换内容没有问题,一切正常 现在我想在更改列表框的值后自动更改文本框的值。例如,更改listbox元素后,活动元素的值应写入上面的文本框。如何访问此元素Javascript tinyMCE插件访问元素,javascript,plugins,tinymce,Javascript,Plugins,Tinymce,我正在尝试编写一个tinymce插件,所以我查阅了在上创建插件的教程。插入和替换内容没有问题,一切正常 现在我想在更改列表框的值后自动更改文本框的值。例如,更改listbox元素后,活动元素的值应写入上面的文本框。如何访问此元素 tinymce.PluginManager.add('myexample', function(editor, url) { // Add a button that opens a window editor.addButton('myexample', {
tinymce.PluginManager.add('myexample', function(editor, url) {
// Add a button that opens a window
editor.addButton('myexample',
{
text: 'Example',
onclick: function()
{
// Open window
editor.windowManager.open({
title: 'Example Plugin',
body: [
// Text
{type: 'textbox', name: 'title', label: 'Text', value: 'temp'},
// Listbox
{type: 'listbox', name: 'test', label: 'Ziel',
'values':
[
{text: 'Eins', value: '1'},
{text: 'Zwei', value: '2'}
],
onselect: function(v)
{
console.log(this.value());
// CHANGE THE VALUE OF THE TEXTBOX ...
// ????
}
}
],
onsubmit: function(e)
{
console.log(e.data.title, e.data.test);
}
});
}
});
}) 现在我找到了解决办法。最好的方法是不要使用内部表单设计器。您可以将IFrame与外部html页面一起使用,然后可以使用document.getElementById
你可以找到一个例子我知道这是一个老问题,但我也面临着同样的问题,我在另一个论坛上发现了这个问题,这挽救了我的一天 标准的tinymce方法是将弹出窗口保存在变量中:
var win = editor.windowManager.open({ //etc
然后访问元素:
win.find('#text'); // where text is the name specified
我希望这能在将来帮助别人。一点也不。首先,tinymce windowmanager动态生成ID,因此;第二,一个页面上可以有数千个元素,并且id不能是唯一的。