2

I need to add to some divs in my tinyMCE content text "here you can add prepared blocks" so user can select this text and click button to replace content with prepared html.

I am having trouble accessing elements within tinyMCE iframe.

I am trying basic stuff first, but it does not work:

$("iframe").on('click', 'div', function(e) {
    e.preventDefault();
    alert('clicked');
});

I have found some solutions that I could access source textarea (and the work good), but what I need is DOM Tree within iframe so I could easily select the divs I need.

4

1 回答 1

1

这就是你想要的

$(ed.getBody()).find('p');

这将使您将编辑器主体作为 jQuery 对象。find 可以用来获取你现在想要的一切

于 2013-04-17T12:23:49.000 回答