如何在CKEditor中将onClick侦听器添加到fileButton? [英] How can I add an onClick listener to a fileButton in CKEditor?

查看:101
本文介绍了如何在CKEditor中将onClick侦听器添加到fileButton?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用图片上传器插件,并且按钮定义如下:

I'm working in the image uploader plugin, and have a button definition like this:

{
    type : 'fileButton',
    id : 'uploadButton',
    filebrowser : 'info:txtUrl',
    label : editor.lang.image.btnUpload,
    'for' : [ 'Upload', 'upload' ],
    onClick : function() {alert('hey')}
}

我已经尝试将函数定义为在别处作为命名函数调用,没有运气。我也无法将onClick侦听器添加到其他元素,但是buttonDefinition类这里明确说明你应该能够在一个按钮上添加一个。

I have tried defining the function to be called elsewhere as a named function, with no luck. I also haven't been able to add an onClick listener to other elements, but the buttonDefinition class here specifically says you should be able to add one to a button.

推荐答案

您是否尝试过:

document.getElementById('uploadButton').onclick = function() {
    alert('Hey!');
}

这篇关于如何在CKEditor中将onClick侦听器添加到fileButton?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆