Jquery events on CKeditor

穿精又带淫゛_ 提交于 2020-01-16 18:15:14

问题


Hello in a form with a textarea with id "ckeditor_input"

$("#ckeditor_input").ckeditor();

$("#ckeditor_input").html(); // can get the value

("#ckeditor_input").click/blur/keydown/keypressed(

   function(){
         alert("OK");
  }
); //doesn't work!

the problem is ckeditor! If I don't start an instance of ckeditor on the textarea all events work fine! What is the right way to get events on a ckeditor instance?

Thank you


回答1:


CKEditor uses an iframe... very annoying for jQuery events. You could try:

$($('#parent-element>iframe').get(0).contentWindow.document).live('click',function() { ... });

I haven't tested it so not entirely sure whether it'll work. But I'm sure that's the starting point for the solution. Let me know how it goes, and if it doesn't work I'll try and work out what the problem is.

Edit:: (based on the comment)

$(CKEDITOR.instances.desc_product).click(function() { ... });

I think that should do it. But only run it after CKEditor has loaded properly.



来源:https://stackoverflow.com/questions/4354774/jquery-events-on-ckeditor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!