Click event on TinyMCE 4.0
javascript, jquery, tinymce, wysiwyg
Solution
TinyMCE v4 has changed things from v3 - try:
setup : function(ed) {
ed.on("click", function() {
alert("Editor Clicked! Element: " + this.target.nodeName);
});
};
Problem
Recently I tried to integrate TinyMce 4.0 in my web application. I want to put a click event for when I click on the textarea but it doesn't work. I have looked on the official documentation, and I've tried the following code: ``` tinyMCE.init({ ... setup : function(ed) { ed.onClick.add(function(ed, e) { console.debug('Editor was clicked: ' + e.target.nodeName); }); } ``` There are an error that appear : "TypeError: ed.onClick is undefined". So, I have tried to put directly a onclick event on the iframe but it's a failure : ``` $("iframe").contents().bind('click', function(){ ... }); ``` Do you have any ideas on how to do this?