我正在 CKEditor 中开发一个插件,它的目标是根据选中的复选框隐藏或显示元素。我定义了那些元素:
contents :
[
{
id : 'tab1',
label : 'Configuration Basique',
elements :
[
{
type : 'checkbox',
id : 'check',
label : 'Vers une page web',
'default' : 'unchecked',
onClick : function(){
}
},
{
type : 'text',
id : 'title',
label : 'Explanation',
}
]
},
{
id : 'tab2',
label : 'Advanced Settings',
elements :
[
{
type : 'text',
id : 'id',
label : 'Id'
}
]
}
],
所以现在我想做的是隐藏不禁用带有标签的文本输入并仅在选中该框时打印它。所以我看到我应该使用类似的东西:
onLoad : function(){
this.getContentElement('tab1','title').disable();
},
但问题是我不想禁用它我想隐藏它然后在用户选中该框时打印它(这就是为什么我在我的复选框中放置了一个 onClick 函数)。我试过使用 hide() 函数,但它不起作用,还有 setAttribute('style','display : none;') 蒂娅:)
最佳答案
如果你真的想隐藏(而不是禁用)你可以使用的元素
this.getContentElement('tab1','title').getElement().hide();
额外的 getElement() 调用返回 contentElement 对象的文字 DOM 对象,因此您可以随意调用 hide()/show()。
关于javascript - 在 CKEditor 的对话框中隐藏文本输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17047266/