开发者

Tinymce click on a textarea?

开发者 https://www.devze.com 2023-02-19 02:04 出处:网络
Im trying to implement a click on 开发者_Go百科a textarea in tincymce through jquery but it does not seem to work. Anyway around this. I am not getting any areas

Im trying to implement a click on 开发者_Go百科a textarea in tincymce through jquery but it does not seem to work. Anyway around this. I am not getting any areas

Thanks

$('textarea').click(function( event ){
    alert('trigger');
});


you can't do that in that way because TinyMce convert your textarea into an iFrame


The editor is not the same with your textarea. As MiPnamic stated it is the iframe.

You may use the following to install a click handler when editor_id is holding your editors id

jQuery('#'+editor_id+'_ifr').click(function( event ){
    alert('trigger');
});

EDIT: Another thing which should work far better in all browsers will be to use this tinymce init setting (tinymce version 3.x)

setup : function(ed) {
   ed.onClick.add(function(ed, evt) {
     alert('trigger');
});

for tinymce version 4.x use:

setup : function(ed) {
   ed.on("click", function() {
    alert('trigger');
   });
});


I created a div around that and used the jquery even around that. Alternatively you can use build in functions to catch events built into tinymce found on the following page

http://tinymce.moxiecode.com/wiki.php/API3:tinymce.api.3.x

0

精彩评论

暂无评论...
验证码 换一张
取 消