0

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

Sandro Antonucci
  • 1,683
  • 5
  • 29
  • 59

1 Answers1

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.

Nathan MacInnes
  • 11,033
  • 4
  • 35
  • 50
  • no...I get -$("#add_news>iframe").get(0) is undefined- If it helps I found this and it works: CKEDITOR.instances.desc_product.on('click', function() { alert('onblur 123'); }); but I need "keypressed" to work (when the user types in it) – Sandro Antonucci Dec 04 '10 at 19:02