【问题标题】:Jquery events on CKeditorCKeditor 上的 Jquery 事件
【发布时间】:2011-05-20 06:42:35
【问题描述】:

你好 在带有 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!

问题是ckeditor!如果我不在 textarea 上启动 ckeditor 实例,所有事件都可以正常工作!在 ckeditor 实例上获取事件的正确方法是什么?

谢谢

【问题讨论】:

    标签: jquery events textarea ckeditor


    【解决方案1】:

    CKEditor 使用 iframe...对于 jQuery 事件非常烦人。你可以试试:

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

    我还没有测试过,所以不能完全确定它是否会起作用。但我确信这是解决方案的起点。让我知道它是怎么回事,如果它不起作用,我会尝试找出问题所在。

    编辑::(基于评论)

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

    我认为应该这样做。但只有在 CKEditor 正确加载后才能运行它。

    【讨论】:

    • no...我得到 -$("#add_news>iframe").get(0) 是未定义的 - 如果它有助于我找到这个并且它有效:CKEDITOR.instances.desc_product.on( '点击',函数(){警报('onblur 123');});但我需要“按键”才能工作(当用户输入时)
    猜你喜欢
    • 1970-01-01
    • 2011-07-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-07
    • 1970-01-01
    • 2019-06-07
    相关资源
    最近更新 更多