Sandro Antonucci
Sandro Antonucci

Reputation: 1753

Jquery events on CKeditor

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

Upvotes: 0

Views: 2810

Answers (1)

Nathan
Nathan

Reputation: 11159

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.

Upvotes: 1

Related Questions