Detect click event inside iframe

前端 未结 9 2185
刺人心
刺人心 2020-11-28 05:40

I\'m writing a plugin for TinyMCE and have a problem with detecting click events inside an iframe.

From my search I\'ve come up with this:

Loading iframe:

9条回答
  •  误落风尘
    2020-11-28 06:14

    The tinymce API takes care of many events in the editors iframe. I strongly suggest to use them. Here is an example for the click handler

    // Adds an observer to the onclick event using tinyMCE.init
    tinyMCE.init({
       ...
       setup : function(ed) {
          ed.onClick.add(function(ed, e) {
               console.debug('Iframe clicked:' + e.target);
          });
       }
    });
    

提交回复
热议问题