admin管理员组文章数量:1319007
How can I bind multiple events on tinymce such that those events e.g. click, keyup and change have the same handler function?
I am trying like this but the events are not firing.
tinymce.dom.Event.add(ed, 'click keyup change', function (ed, e) {
// Handler here...
});
I also tried this where ed is my document
ed.bind('click keyup change', function (ed, e) {
// Handler here...
});
but bind is not defined for tinymce. How can I get this working?
Thanks :)
How can I bind multiple events on tinymce such that those events e.g. click, keyup and change have the same handler function?
I am trying like this but the events are not firing.
tinymce.dom.Event.add(ed, 'click keyup change', function (ed, e) {
// Handler here...
});
I also tried this where ed is my document
ed.bind('click keyup change', function (ed, e) {
// Handler here...
});
but bind is not defined for tinymce. How can I get this working?
Thanks :)
Share Improve this question asked Mar 28, 2013 at 18:54 BerniceBernice 2,59211 gold badges45 silver badges75 bronze badges 2-
1
I'm not familiar with
tinymce
but you can create a function then pass it without()
as callback. – Ricardo Lohmann Commented Mar 28, 2013 at 18:58 -
tinymce.dom.Event.add(ed, 'click', thefunction);
tinymce.dom.Event.add(ed, 'keyup', thefunction);
function thefunction(){ //whatever }
– David Fregoli Commented Mar 28, 2013 at 19:00
2 Answers
Reset to default 8function myFunction(ed, e) {
// do what you want
}
tinymce.dom.Event.add(ed, 'click', myFunction);
tinymce.dom.Event.add(ed, 'keyup', myFunction);
tinymce.dom.Event.add(ed, 'change', myFunction);
Make one callback function and pass it to each of them
I do not believe that tinymce
gives you the ability to add multiple events at once.
For example:
callbackFn = function (ed, e) {
// Handler here...
};
tinymce.dom.Event.add(ed, 'click', callbackFn );
tinymce.dom.Event.add(ed, 'keyup', callbackFn );
...
本文标签: javascriptBinding multiple eventsStack Overflow
版权声明:本文标题:javascript - Binding multiple events - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742053171a2418157.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论