Binding multiple events

events, javascript, jquery, tinymce

Solution

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);

Problem

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 :)

Original source