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 :)
function 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 );
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With